I know context is required to accurately determine a word's part of speech, but does this library provide a way to guess (or pick the word's most common part of speech)?
Something like...
nlp.term('cheese').pos()
// => probably a noun
This library is basically "guessing" each word's part of speech based on it's spelling, and then makes minor adjustments depending on the context.
So,
nlp.sentence('cheese')
is an object that contains the following:
Sentence {
str: 'cheese',
terms:
[ Noun {
whitespace: [Object],
text: 'cheese',
normal: 'cheese',
expansion: null,
reason: 'lexicon_pass',
pos: [Object],
tag: 'Noun' } ],
contractions: { expand: [Function], contract: [Function] } }
As you see, tag: 'Noun'.
To extract part of speech for a single word, use:
nlp.sentence('cheese').terms[0].tag
// => 'Noun'
exactly. The perfect tagger also should know the user's cultural setting too, like 'smashed' means drunk in america, but tired in britain...
so often the sentence/text is not even enough.
This library just tries to 80-20 rule the most-common pos, in an opinionated-but-fair way. If you know the context in advance, you can coerce certain words like this.
but like Ilya says,
nlp.sentence("the cheese").tags()
// Noun
nlp.sentence("he would cheese the bagel").tags()
// Verb
cheers
Good stuff. Thanks @ilyankou and @spencermountain
Most helpful comment
This library is basically "guessing" each word's part of speech based on it's spelling, and then makes minor adjustments depending on the context.
So,
is an object that contains the following:
As you see,
tag: 'Noun'.To extract part of speech for a single word, use: