English: a vs an (index.html) (../../img/transparent-blob.png) (Blog posts) (https://www.redblobgames.com/blog/posts.xml) English: a vs an from (https://www.redblobgames.com/blog/) Red Blob Games’s Blog (https://www.redblobgames.com/) Home (https://www.redblobgames.com/blog/) Blog (https://pinboard.in/u:amitp/t:gamedev/) Links (https://bsky.app/profile/redblobgames.com) Bluesky (http://www-cs-students.stanford.edu/~amitp/) About (Search) (site:www.redblobgames.com OR site:theory.stanford.edu/~amitp/ OR site:www-cs-students.stanford.edu/~amitp/ OR site:amitp.blogspot.com OR site:simblob.blogspot.com) Blog post:
16 Sep 2026 In English, there is an “indefinite” article a that can go before a word. For example, a raccoon . But for some words, we use an . For example, an apple . When procedurally generating text, I want a function a_or_an("apple") that tells me which article to use. That seems
like it’d be easy. We can check the first letter to see if it’s a
vowel. But that would mean we output an unicorn , not a unicorn . The actual rule is not whether the written word starts with a
vowel letter, but whether the spoken word starts with a vowel
sound. The word starts with vowel letter ( ) but a
consonant sound (cmudict Y , ipa /j/ ). The word starts with a consonant letter ( ) but a vowel sound (cmudict AW , ipa /aʊ/ ). (https://www.redblobgames.com/x/2635-a-vs-an/blog/level-2f.png) (Tree style visualization of the first two letters of a word) Visualization showing whether the first two letters of a word are enough to determine whether it should have “a” or “an” I was curious how often these exceptions occurred, and whether they can be grouped together, so (https://www.redblobgames.com/x/2635-a-vs-an/) I spent a day looking at the data and building some visualizations and wrote up the results. I was surprised that only 129 of the 32,455 words in my list needed exceptions. [LLM note: I did not use LLMs to write any of this code, but in hindsight, I should have. This is one-off code to answer a question. It doesn’t need to be clean or maintainable. It only needs to be correct. I would’ve spent more time on the trie simplification algorithm and less time on parsing cmudict and re-learning d3.js.] Email me (mailto:redblobgames@gmail.com) redblobgames@gmail.com , or comment here: Load comments from Disqus (https://redblobgames.disqus.com/?url=https://www.redblobgames.com/blog/2026-09-16-english-a-vs-an/) View the discussion thread. Copyright © 2026 (https://www.redblobgames.com/) Red Blob Games (https://www.redblobgames.com/blog/posts.xml) RSS Feed Created 16 Sep 2026; Last modified: 19 Sep 2026