Contract each match on its own instead of merging them into one
This commit is contained in:
1 parent
163edfec77
commit
cab0138668
2 files changed
+25
-5
No files matched your search
@@ -1,10 +1,6 @@
|
||||
const postPunct = /[,)"';:\-–—.…]/
|
||||
|
||||
const setContraction = function (m, suffix) {
|
||||
if (!m.found) {
|
||||
return
|
||||
}
|
||||
const terms = m.termList()
|
||||
const contractTerms = function (terms, suffix) {
|
||||
//avoid any problematic punctuation
|
||||
for (let i = 0; i < terms.length - 1; i++) {
|
||||
const t = terms[i]
|
||||
@@ -27,6 +23,11 @@ const setContraction = function (m, suffix) {
|
||||
}
|
||||
}
|
||||
|
||||
// contract each match on its own
|
||||
const setContraction = function (m, suffix) {
|
||||
m.docs.forEach(terms => contractTerms(terms, suffix))
|
||||
}
|
||||
|
||||
/** turn 'i am' into i'm */
|
||||
const contract = function () {
|
||||
const doc = this.not('@hasContraction')
|
||||
|
||||
Reference in new issue
Block a user