Upstream spencermountain/compromise state of the touched files before d01da120a4

This commit is contained in:
upstream committed 2026-10-03 03:06:19 +02:00
1 parent e5211cc15a
commit 163edfec77
2 files changed
+2 -19

No files matched your search

+2 -2
View File
@@ -45,8 +45,8 @@ const contract = function () {
// spencer would -> spencer'd // spencer would -> spencer'd
m = doc.match('#Person would') m = doc.match('#Person would')
setContraction(m, `'d`) setContraction(m, `'d`)
// would not -> wouldn't (skip words already contracted above, like he's) // would not -> wouldn't
m = doc.match('(is|was|had|would|should|could|do|does|have|has|can) not').ifNo('@hasContraction') m = doc.match('(is|was|had|would|should|could|do|does|have|has|can) not')
setContraction(m, `n't`) setContraction(m, `n't`)
// i have -> i've // i have -> i've
m = doc.match('(i|we|they) have') m = doc.match('(i|we|they) have')
-17
View File
@@ -41,23 +41,6 @@ test('contract basic', function (t) {
t.end() t.end()
}) })
test('contract before not', function (t) {
let doc = nlp('he is not here')
doc.contract()
t.equal(doc.text(), `he's not here`, here + 'he is not')
doc.contractions().expand()
t.equal(doc.text(), 'he is not here', here + 'he is not expand')
doc = nlp('spencer is not here')
doc.contract()
t.equal(doc.text(), `spencer's not here`, here + 'spencer is not')
doc = nlp('that is not true')
doc.contract()
t.equal(doc.text(), `that isn't true`, here + 'that is not')
t.end()
})
test('avoid contraction messes', function (t) { test('avoid contraction messes', function (t) {
let doc = nlp('Tony, is').contract() let doc = nlp('Tony, is').contract()
t.equal(doc.has('is'), true, here + 'avoid-contraction 1') t.equal(doc.has('is'), true, here + 'avoid-contraction 1')