Method: Wiktionary::Noun#singularize
- Defined in:
- lib/wiktionary/noun.rb
#singularize(noun) ⇒ Object
Returns list of possible singular forms of noun.
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/wiktionary/noun.rb', line 43 def singularize(noun) first_capital = false if noun =~ /^\p{Lu}/ noun = UnicodeUtils.downcase(noun[0]) + noun[1..-1] first_capital = true end result = @plural_to_singulars[noun] if first_capital result.map!{|word| UnicodeUtils.upcase(word[0]) + word[1..-1] } end result end |