Javascript library to determine indefinite article

javascript, regex, string

Solution

The following Javascript library by Eamon Nerbonne should be what you are looking for: http://home.nerbonne.org/A-vs-An/AvsAn.js

This was actually created as an answer to a similar question here on SO: https://stackoverflow.com/a/1288473/505154

The approach used here was to download Wikipedia, filter it, and create a prefix database to determine a/an, which should be more accurate than most rules-based systems. You can find more information at the following location (also linked in the above answer): http://home.nerbonne.org/A-vs-An/

There is also a link there to an alternative implementation by Chad Kirby: https://github.com/uplake/Articles

Problem

Are there any javascript libraries that exist for determining the indefinite article ("a" vs "an") of a noun? I can start with a simple regex like so: ``` var pattern = /^([aeiou])/i; pattern.test("umbrella"); ``` but this doesn't handle a case like: "user" which should return false (you wouldn't say "an user clicked the button").

Original source

Related problems