UNPKG

compromise

Version:

modest natural language processing

15 lines (12 loc) • 636 B
import { getTense } from '../lib.js' import { Inf, Participle } from '../../../../2-two/preTagger/tagSet/_lib.js' // Inflect the lexical root only, using its existing tags to disambiguate tense. export const infinitive = (root, format = 'normal') => { return root.methods.two.transform.verb.toInfinitive(root.text(format), root.model, getTense(root)) } export const inflect = (root, tense, format) => { const word = infinitive(root, format) if (tense === Inf) return word const forms = root.methods.two.transform.verb.conjugate(word, root.model) return forms[tense] || (tense === Participle ? forms.PastTense : undefined) }