Upstream spencermountain/compromise state of the touched files before 5162a87839
This commit is contained in:
1 parent
be4f52b481
commit
e4149a971e
2 files changed
+526
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { doDoes, getTense } from '../lib.js'
|
||||
const keep = { tags: true }
|
||||
|
||||
// all verb forms are the same
|
||||
const toInf = function (vb, parsed) {
|
||||
const { toInfinitive } = vb.methods.two.transform.verb
|
||||
const { root, auxiliary } = parsed
|
||||
const aux = auxiliary.terms().harden()
|
||||
let str = root.text('normal')
|
||||
str = toInfinitive(str, vb.model, getTense(root))
|
||||
if (str) {
|
||||
vb.replace(root, str, keep).tag('Verb').firstTerm().tag('Infinitive')
|
||||
}
|
||||
// remove any auxiliary terms
|
||||
if (aux.found) {
|
||||
vb.remove(aux)
|
||||
}
|
||||
// there is no real way to do this
|
||||
// 'i not walk'? 'i walk not'?
|
||||
if (parsed.negative.found) {
|
||||
if (!vb.has('not')) {
|
||||
vb.prepend('not')
|
||||
}
|
||||
const does = doDoes(vb, parsed)
|
||||
vb.prepend(does)
|
||||
}
|
||||
vb.fullSentence().compute(['freeze', 'lexicon', 'preTagger', 'postTagger', 'unfreeze', 'chunks'])
|
||||
return vb
|
||||
}
|
||||
export default toInf
|
||||
Reference in new issue
Block a user