plurals / pluralize

Pluralize or singularize any word based on a count
MIT License
2.14k stars 180 forks source link

Similar library but for articles #195

Open avin-kavish opened 2 years ago

avin-kavish commented 2 years ago

Is there a similar library for chosing between a and an given a word?

ronssij commented 2 years ago

@avin-kavish I think you can create your own. you have check if the first letter of a value passed starts with a vowel. but there are possibilites that a value starts a vowel but uses an "a" article.

eg. a university

and you should store them in a "library".

like what the author did to irregular rules and uncountable rules.

avin-kavish commented 2 years ago

I know. I'm looking for a maintained library, or one I can fork. Do you have an (ideally exhaustive) reference of those exceptional cases?

matthewberryman commented 2 years ago

Might be worth starting with something like https://www.npmjs.com/package/@informath/text-to-ipa and then checking to see if the first sound is a vowel sound or not? Just noting that this is dialect specific, e.g. "an herb" (American English) vs "a herb" (Australian English) so it's not something you can derive from the written text alone.

kennydifiore commented 2 years ago

@avin-kavish Check out this library: https://www.npmjs.com/package/indefinite