ActiveSupport Inflection library for Past Tense in Ruby?
Is there a past tense library for ruby, to convert words into th开发者_运维知识库e past tense?
Check out the 'verbs' ruby gem ( github | rubygems | documentation ).
Type this in the command-line:
gem install verbs
Add this to your gemfile:
gem "verbs", "~> 2.1.0"
And make sure to restart your rails server and exit your rails console before implementing.
Past tense of English verbs is a lot more complicated than pluralization. You'll need a lingustic analysis engine and a corresponding database (due to the irregularity of the English language). If you're interested in pursuing this further, you can look at Ruby-WordNet which uses the WordNet lexical database.
精彩评论