compromise
Version:
natural language processing in the browser
79 lines (73 loc) • 2.06 kB
JavaScript
;
//markov-like stats about co-occurance, for hints about unknown terms
//basically, a little-bit better than the noun-fallback
//just top n-grams from nlp tags, generated from nlp-corpus
//after this word, here's what happens usually
let afterThisWord = {
i: 'Verb', //44% //i walk..
first: 'Noun', //50% //first principles..
it: 'Verb', //33%
there: 'Verb', //35%
to: 'Verb', //32%
not: 'Verb', //33%
because: 'Noun', //31%
if: 'Noun', //32%
but: 'Noun', //26%
who: 'Verb', //40%
this: 'Noun', //37%
his: 'Noun', //48%
when: 'Noun', //33%
you: 'Verb', //35%
very: 'Adjective', // 39%
old: 'Noun', //51%
never: 'Verb', //42%
before: 'Noun', //28%
};
//in advance of this word, this is what happens usually
let beforeThisWord = {
there: 'Verb', //23% // be there
me: 'Verb', //31% //see me
man: 'Adjective', // 80% //quiet man
only: 'Verb', //27% //sees only
him: 'Verb', //32% //show him
were: 'Noun', //48% //we were
what: 'Verb', //25% //know what
took: 'Noun', //38% //he took
himself: 'Verb', //31% //see himself
went: 'Noun', //43% //he went
who: 'Noun', //47% //person who
jr: 'Person'
};
//following this POS, this is likely
let afterThisPos = {
Adjective: 'Noun', //36% //blue dress
Possessive: 'Noun', //41% //his song
Determiner: 'Noun', //47%
Adverb: 'Verb', //20%
// Person: 'Verb', //40%
Pronoun: 'Verb', //40%
Value: 'Noun', //47%
Ordinal: 'Noun', //53%
Modal: 'Verb', //35%
Superlative: 'Noun', //43%
Demonym: 'Noun', //38%
Organization: 'Verb', //33%
Honorific: 'Person', //
// FirstName: 'Person', //
};
//in advance of this POS, this is likely
let beforeThisPos = {
Copula: 'Noun', //44% //spencer is
PastTense: 'Noun', //33% //spencer walked
Conjunction: 'Noun', //36%
Modal: 'Noun', //38%
PluperfectTense: 'Noun', //40%
PerfectTense: 'Verb', //32%
// LastName: 'FirstName', //
};
module.exports = {
beforeThisWord: beforeThisWord,
afterThisWord: afterThisWord,
beforeThisPos: beforeThisPos,
afterThisPos: afterThisPos
};