Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var watson = require('watson-developer-cloud');
- var swearjar = require('swearjar');
- var language_translator = watson.language_translator({
- username: 'fc15a4b5-c336-4de9-bd72-bc9d3928371c',
- password: 'IDJdrL2Zj5TQ',
- version: 'v2'
- });
- if(!swearjar.profane("hello this is a test of the profanity function."))
- language_translator.identify({ text: 'hello this is a test of the profanity function.'},
- function(err, identifiedLanguages) {
- if (err)
- console.log(err);
- else {
- identifiedLanguages.languages.forEach(function(lang) {
- if (lang.language === 'en')
- if (lang.confidence > '.8') //if its over .8 certainty
- console.log(lang.confidence); //prints english confidence
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement