Keep a titlecase comparative before 'than' as an adjective

This commit is contained in:
dualfroz committed 2026-10-03 03:10:44 +02:00
1 parent 1adeb19882
commit 7ccd4a2b95
2 files changed
+20

No files matched your search

@@ -32,6 +32,10 @@ const checkCase = function (terms, i, model) {
if (notProper.find(tag => term.tags.has(tag))) {
return null
}
// known comparative - 'is Higher than 16'
if (term.tags.has('Comparative') && terms[i + 1]?.normal === 'than') {
return null
}
// A heading can start a new clause: 'Tutorial: Creating a cake'.
if (i === 0 && term.tags.has('Gerund') && terms[i + 1]?.tags.has('Determiner')) {
return null
+16
View File
@@ -0,0 +1,16 @@
import test from 'tape'
import nlp from '../_lib.js'
const here = '[two/titlecase] '
test('titlecase comparative before than', function (t) {
const arr = [
['when quantity is Higher than 16 do X', 'is #Comparative than'],
['it is Bigger than that', 'is #Comparative than'],
['prices were Cheaper than expected', 'were #Comparative than'],
]
arr.forEach(a => {
t.equal(nlp(a[0]).has(a[1]), true, here + a[0])
})
t.equal(nlp('we met Young yesterday').has('#ProperNoun'), true, here + 'still a name')
t.end()
})