Python Forum
A function for correctly using "a/an" before a word
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A function for correctly using "a/an" before a word
#1
I want to make a function that, when passed a string containing a single word, returns that word preceded by the indefinite article "a" or "an," depending on which is correct. This would be easy enough to do if the rule we were taught as kids were correct: "a" before a consonant, "an" before a vowel. But it isn't. It's "a" before a consonant sound and "an" before a vowel sound; hence, "an umbrella" but "a unicorn" (YOO-ni-corn). How would you go about writing this function? Would you try to compile an exhaustive list of "exceptions" from online sources or work with some kind of API or what? Also, how would you find out if someone has already done this?
Reply


Messages In This Thread
A function for correctly using "a/an" before a word - by Exsul1 - Oct-07-2019, 05:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Speech recognition, word by word AceScottie 6 9,007 Apr-12-2020, 09:50 AM
Last Post: vinayakdhage
  print a word after specific word search evilcode1 8 831 Oct-22-2019, 08:08 AM
Last Post: newbieAuggie2019
  Python function that uses a word as the encryption key, rather than an integer wak_stephanie 4 1,801 Aug-31-2018, 12:16 PM
Last Post: perfringo
  difference between word: and word[:] in for loop zowhair 2 1,470 Mar-03-2018, 07:24 AM
Last Post: zowhair

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020