chronic

https://github.com/mojombo/chronic

Ruby

Chronic is a pure Ruby natural language date parser.

Chronic::Parser#pre_normalize

Clean up the specified text ready for parsing.

Clean up the string by stripping unwanted characters, converting
idioms to their canonical form, converting number words to numbers
(three => 3), and converting ordinal words to numeric
ordinals (third => 3rd)

text - The String text to normalize.

Examples:

  Chronic.pre_normalize('first day in May')
    #=> "1st day in may"

  Chronic.pre_normalize('tomorrow after noon')
    #=> "next day future 12:00"

  Chronic.pre_normalize('one hundred and thirty six days from now')
    #=> "136 days future this second"

Returns a new String ready for Chronic to parse.

Source | Google | Stack overflow

Edit

git clone [email protected]:mojombo/chronic.git

cd chronic

open lib/chronic/parser.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chronic--Parser-pre_normalize-for-pr


# Commit to git

git add lib/chronic/parser.rbgit commit -m "better docs for Chronic::Parser#pre_normalize"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Chronic--Parser-pre_normalize-for-pr

hub pull-request


# Celebrate!