v7 is still in the process of being built, so this is just a general query about how the API will work, rather than a bug report.
I know how to pluralize a single noun: nlp("animal").nouns().toPlural().out("text"), but am not sure about the best approach for noun-phrases.
nlp("brazil nut").nouns().toPlural().out("text"); // "brazil nuts" <-- correct! :D
nlp("coconut cream").nouns().toPlural().out("text"); // "coconuts creams"
nlp("brown rice").nouns().toPlural().out("text"); // " rice"
nlp("human right").nouns().toPlural().out("text"); // "humans"
nlp('kiwi fruit').nouns().toPlural().out("text"); // "kiwis fruit"
nlp('crab apple').nouns().toPlural().out("text") // "crabs apples"
http://jsbin.com/fiducotuha/4/edit?html,console
Would .nouns().last() be the best approach for this sort of thing (when last() is added)? Or is there (/will there be) a better approach? Cheers :)
haha ;) yeah!
it's like you can just smell it starting to work. thanks for your patience with this.
i remember doing some of this in v6. .last() is good, but some situations like mayor of chicago want the first one inflected...
Lets think about this. You can see I haven't sorted-out the concept of a noun-phrase very well. Maybe we should define it. brown rice is a nounphrase, but brown delicious rice probably isn't. :worried:
maybe this concept of pluralizing is a good way to think about it. Maybe .nouns() is just too ambiguous and dumb and we should do some other way of slicing things.
What are you using it for? It sounds like recipe software. maybe we need a .food() ;)
Ah, very good points! Seems a little more complicated than I assumed. I'm not sure how naive this solution would be, but what if there were a list of POS patterns and their most likely pluralization? Like:
Would need to take into account whether the noun is uncountable too: "red furniture" shouldn't be converted into "red furnitures". Hmm - this is a tough one! (Edit: Oh, but of course your single-noun pluralizing function can handle all of that word-level stuff)
Haha not quite! I'm using it for a little random text generator language/DSL platform thing. Will definitely share it with you and give compromise some love in the credits when it's done! :)
yeah, exactly. let me take a crack at this today, then you can kick the tires to see how it goes
thanks
Cool! Looking forward to it :+1:
This is important stuff! Let me know how I might help.
hey, just getting back to this. situation's a little better, but still not very good
https://runkit.com/583f2a3dc534df0014136221/58c8282b5763290014d7b461