Upstream spencermountain/compromise state of the touched files before 610e7f53be
This commit is contained in:
1 parent
a6e9f786c4
commit
3af928964b
2 files changed
+1
-21
No files matched your search
@@ -46,11 +46,8 @@ const contract = function () {
|
|||||||
m = doc.match('#Person would')
|
m = doc.match('#Person would')
|
||||||
setContraction(m, `'d`)
|
setContraction(m, `'d`)
|
||||||
// would not -> wouldn't
|
// would not -> wouldn't
|
||||||
m = doc.match('(is|was|were|had|would|should|could|do|does|did|have|has) not')
|
m = doc.match('(is|was|had|would|should|could|do|does|have|has|can) not')
|
||||||
setContraction(m, `n't`)
|
setContraction(m, `n't`)
|
||||||
// can not -> can't
|
|
||||||
m = doc.match('can not')
|
|
||||||
setContraction(m, `'t`)
|
|
||||||
// i have -> i've
|
// i have -> i've
|
||||||
m = doc.match('(i|we|they) have')
|
m = doc.match('(i|we|they) have')
|
||||||
setContraction(m, `'ve`)
|
setContraction(m, `'ve`)
|
||||||
|
|||||||
@@ -74,20 +74,3 @@ test('multiple contraction in sentence', function (t) {
|
|||||||
t.equal(doc.match('he is dead').length, 2, here + 'multi-contraction-count')
|
t.equal(doc.match('he is dead').length, 2, here + 'multi-contraction-count')
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('contract negatives', function (t) {
|
|
||||||
const arr = [
|
|
||||||
['I can not go', `I can't go`],
|
|
||||||
['You Can not go', `You Can't go`],
|
|
||||||
['i did not go', `i didn't go`],
|
|
||||||
['they were not here', `they weren't here`],
|
|
||||||
]
|
|
||||||
arr.forEach(a => {
|
|
||||||
const doc = nlp(a[0])
|
|
||||||
doc.contract()
|
|
||||||
t.equal(doc.text(), a[1], here + a[0])
|
|
||||||
doc.contractions().expand()
|
|
||||||
t.equal(doc.text(), a[0], here + 'expand ' + a[0])
|
|
||||||
})
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
Reference in new issue
Block a user