Write a script that will help determine the indefinite article of a word ('a' or 'an'). The test strings below demonstrate some of the complexities of this grammar rule to be aware of. But test it aginst as many strings as you can think of.
Some conditions do not need to be considered for this challenge.
- Don't worry about "Uncountable" words such as "air" or "salt" they don't count (Ha! Pun!).
- Consider all words to be an "American" accent. "an herb" (American silent H) vs "a herb" (European hard H) when testing. Bonus points (not that there are points or anything) if you have the ability to match based of accent.
'apple',
'boy',
'car',
'dog',
'elephant',
'eulogy',
'euro',
'european',
'espresso',
'farm',
'goat',
'helicopter',
'honor',
'house',
'hour',
'hound',
'umbrella',
'undisclosed',
'unit',
'university',
'apple' : 'an',
'boy' : 'a',
'car' : 'a',
'dog' : 'a',
'elephant' : 'an',
'eulogy' : 'a',
'euro' : 'a',
'european' : 'a',
'espresso' : 'an',
'farm' : 'a',
'goat' : 'a',
'helicopter' : 'a',
'honor' : 'an',
'house' : 'a',
'hour' : 'an',
'hound' : 'a',
'umbrella' : 'an',
'undisclosed' : 'an',
'unit' : 'a',
'university' : 'a',
Expand on the test words: Find other words to put to the test. This grammar rule has some interesting exceptions that may make it more of a challenge with more words.
Accent Option: Test against alternate accents that may change the article of some words.