Skip to content

Instantly share code, notes, and snippets.

@jw-jenrise
Last active June 27, 2019 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jw-jenrise/d916e266984b9d712dbeabb7bc7a9914 to your computer and use it in GitHub Desktop.
Save jw-jenrise/d916e266984b9d712dbeabb7bc7a9914 to your computer and use it in GitHub Desktop.
AWS - Proper noun filtering
// AWS Comprehence
//http://www.jsonquerytool.com/
var filteredToken = _.filter(
input.SyntaxTokens,
function(token) {
return token.PartOfSpeech.Tag == "PROPN" && token.PartOfSpeech.Score > 0.95;
}).sort(function(t1,t2){
return t2.PartOfSpeech.Score - t1.PartOfSpeech.Score;
}).map(function(token){
return {
"confidence" : Math.floor(token.PartOfSpeech.Score * 100,2),
"text": token.Text
}
});
filteredToken;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment