From: Peter Camilleri Date: 2011-11-07T08:11:47+09:00 Subject: Re: "A" and "an" articles in front of words Indeed. My understanding is that the usage of a/an depends on the pronunciation of the next word. In the case of unicorn, it sounds like it begins with a "you", hence "a unicorn" on the flip side, consider the phrase "I'll be there in an hour", silent 'h' so we use "an hour" So this very general regex will be enough for most cases, but wont solve the problem at hand entirely. On Mon, Nov 7, 2011 at 9:27 AM, Hassan Schroeder wrote: > On Sun, Nov 6, 2011 at 12:59 PM, steve ross wrote: > >> def article_for(noun) >>  article = %w(a e i o u).include?(noun[0..0]) ? 'an' : 'a' >>  "#{article} #{noun}" >> end >> >> irb(main):022:0> article_for 'dog' >> => "a dog" >> irb(main):023:0> article_for 'animal' >> => "an animal" > >> article_for 'unicorn' >  => "an unicorn"  # => oops :-) > > -- > Hassan Schroeder ------------------------ hassan.schroeder@gmail.com > http://about.me/hassanschroeder > twitter: @hassan > >