I'm trying to use the compromise library to pluralize/singularize sentences that take these forms:
const str1 = "10 dog";
const str2 = "a man and 3 cat";
const str3 = "a bear";
If I use the pluralize
method from compromise, it returns the list of plural nouns or verbs, but I'm trying to figure out how to get it to pluralize the entire string.
const nlp = require("compromise");
const doc = nlp(str2);
const finalStr = doc.nouns().toPlural().out("normal"); // "man cats" instead of "a man and 3 cats";