Advertisement
Guest User

Untitled

a guest
Jan 27th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. var watson = require('watson-developer-cloud');
  2. var swearjar = require('swearjar');
  3. var language_translator = watson.language_translator({
  4. username: 'fc15a4b5-c336-4de9-bd72-bc9d3928371c',
  5. password: 'IDJdrL2Zj5TQ',
  6. version: 'v2'
  7. });
  8. if(!swearjar.profane("hello this is a test of the profanity function."))
  9. language_translator.identify({ text: 'hello this is a test of the profanity function.'},
  10. function(err, identifiedLanguages) {
  11. if (err)
  12. console.log(err);
  13. else {
  14. identifiedLanguages.languages.forEach(function(lang) {
  15. if (lang.language === 'en')
  16. if (lang.confidence > '.8') //if its over .8 certainty
  17. console.log(lang.confidence); //prints english confidence
  18. });
  19. }
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement