Parse 'a dozen' and 'two dozen' as numbers

This commit is contained in:
dualfroz committed 2026-10-03 13:13:25 +02:00
1 parent fc63a2350d
commit 48afa5de19
3 files changed
+25

No files matched your search

+15
View File
@@ -45,3 +45,18 @@ test('parse numbers', function (t) {
})
t.end()
})
test('parse dozen', function (t) {
const arr = [
['a dozen', 12],
['two dozen eggs', 24],
['three dozen', 36],
['i bought a dozen eggs', 12],
['half a dozen eggs', 6],
]
arr.forEach(function (a) {
const num = nlp(a[0]).numbers().get()[0]
t.equal(num, a[1], here + a[0])
})
t.end()
})