Created
March 11, 2020 10:40
-
-
Save michaeldoye/6beb002e34c3ce14abf1c00f08862a60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NaturalLanguageUnderstandingV1 = require('ibm-watson/natural-language-understanding/v1'); | |
const { IamAuthenticator } = require('ibm-watson/auth'); | |
const fs = require('fs'); | |
const naturalLanguageUnderstanding = new NaturalLanguageUnderstandingV1({ | |
version: '2019-07-12', | |
authenticator: new IamAuthenticator({ | |
apikey: '[api_key]', | |
}), | |
url: '[URL]', | |
}); | |
const data = fs.readFileSync('text.txt', 'utf8'); | |
const analyzeParams = { | |
'text': data, | |
// 'url': 'https://www.glassdoor.co.uk/Location/Mobiquity-Amsterdam-Location-EI_IE403884.0,9_IL.10,19_IC3064478.htm', | |
'limit_text_characters': 100000, | |
"return_analyzed_text": true, | |
'features': { | |
'emotion': { | |
'targets': [ | |
'mario', | |
] | |
} | |
}, | |
}; | |
naturalLanguageUnderstanding.analyze(analyzeParams) | |
.then(analysisResults => { | |
console.log(JSON.stringify(analysisResults, null, 2)); | |
}) | |
.catch(err => { | |
console.log('error:', err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment