Skip to content

Instantly share code, notes, and snippets.

@noahlange
Last active December 23, 2018 14:41
Show Gist options
  • Save noahlange/779ae753b87bc3fffdc2c5c3b58e34d0 to your computer and use it in GitHub Desktop.
Save noahlange/779ae753b87bc3fffdc2c5c3b58e34d0 to your computer and use it in GitHub Desktop.
wink-pos-tagger: support for comparative adjectives
if (!pos) {
// may need to match either two or three characters (repeating consonants)
for (let c = 2; c <= 3; c++) {
// attempt to match
const match = (lexicon[word.slice(0, -c)] || [])[0];
if (match) {
pos =
// adjectives: taller, shorter
match === 'JJ'
? 'JJR'
: // agent nouns: reader, miner; occupations: trumpeter, cricketer; demonyms: Londoner
match === 'VB' || match === 'NN' || match === 'NNP'
? 'NN'
: // no idea, probably a noun
pos;
}
if (pos) {
// bail early
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment