Reputation: 5220
I'm using the excellent nlp-compromise
module for NLP.
I'm stuck at what should be a rather straightforward process: pluralizing or singularizing all nouns.
So far, I've got this:
let a = nlp("apples, oranges, pears")
a.nouns().toSingular()
a.out("text")
However, this returns
apple, oranges, pears
Whilst what I really want is
apple, orange, pear
Upvotes: 0
Views: 952
Reputation: 6636
this was a bug that just got fixed in v10.6.0
.
https://runkit.com/spencermountain/595e48ab230e340012e1d314
(especially) with the commas, they are indeed three nouns, which all now inflect individually.
thanks for your help.
Upvotes: 1
Reputation: 5220
I've poured over the limited documentation without much success. However, I've stumbled upon a workaround of sorts:
a.match("#Noun").nouns().toSingular()
This appears to match all the nouns, instead of just the first one, returning
apple, orange, pear
Upvotes: 1