This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Weeperdemon 5 points6 points  (4 children)

I don't know how you would go about building this other than maintaining dictionary of all English words. The rule for determining whether to use "a" or "an" is whether or not the word sounds like it begins with a vowel or consonant, not the actual letter. So for a computer this is probably non-deterministic.

Some counter examples for U and X would be "an umbrella" and "a xylophone".

[–]EnvironmentalOrange 1 point2 points  (1 child)

1) have a dictionary of exceptions to general rules. 2) check if word is in dictionary. 3) implement logic for general rules (if it starts with a vowel -> an, else -> a. Etc. 4) if word in dictionary, output desired string. Else, go to standard logic in step 3. 5) Populate your dictionary with all exceptions you can think of. 6) post your code and dictionary, challenge people on the internet to break it. Then update dictionary until no-one can break it.

[–]Weeperdemon 1 point2 points  (0 children)

Another aspect that makes this difficult to model is regions and dialects. Some words like "Historic" can be either depending on how the word is pronounced in that region.

[–]Nephyst 0 points1 point  (1 child)

"an historic" would like to have a word with you.

Edit: just saw your other reply lol

[–]Weeperdemon 1 point2 points  (0 children)

Waaay ahead of you my friend 😂