English: A vs. An
In the English language, there exists an indefinite article "a" that can precede a word, as in "a raccoon." However, certain words require the use of "an," such as "an apple." When creating text programmatically, I sought a function called a_or_an( apple ) that would determine which article to employ. At first glance, it might appear straightforward to simply examine the first letter for a vowel.
Regrettably, this approach would result in outputting "an unicorn," instead of the correct "a unicorn." The true rule lies not in whether the written word commences with a vowel letter, but whether the spoken word begins with a vowel sound. For instance, the word "unicorn" initiates with the vowel letter "u," yet it begins with a consonant sound "Y."
Conversely, "hour" begins with a consonant letter "h," yet it begins with a vowel sound "OW." Intrigued by the prevalence of these exceptions, I dedicated a day to analyzing the data, constructing visualizations, and compiling the findings. To my astonishment, merely 129 out of the 32,455 words within my dataset necessitated exceptions.
Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.