Project

herbalist

0.01
No commit activity in last 3 years
No release in over 3 years
Herbalist is a natural language measurements parser.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0

Runtime

~> 0.1
~> 0.2
 Project Readme

herbalist¶ ↑

Herbalist is a natural language measurements parser. It is built on top of the Alchemist gem and draws heavily from the Chronic.

Installation¶ ↑

$ sudo gem sources -a http://gemcutter.org
$ sudo gem install herbalist

Usage¶ ↑

>> require 'herbalist'
>> Herbalist.parse("a quarter cup")
=> #<Alchemist::NumericConversion @value=0.25, @exponent=1.0, @unit_name=:cup>

>> Herbalist.parse("it was two and a half football fields")
=> #<Alchemist::NumericConversion @value=2.5, @exponent=1.0, @unit_name=:football_fields>

>> Herbalist.parse('twenty-one and a half Miles')
=> #<Alchemist::NumericConversion @value=21.5, @exponent=1.0, @unit_name=:miles>

>> Herbalist.parse('fifteen kilowatt Hours')
=> #<Alchemist::NumericConversion @value=15.0, @exponent=1.0, @unit_name=:kilowatt_hours>

Limitations¶ ↑

Parsing is limited to units that Alchemist can understand.

TODO¶ ↑

-Allow parsing of units directly next to digits (ed 4m, 21.5L) -Add options to limit which type of units to parse (only volume or distance)

Copyright © 2009 John Duff. See LICENSE for details.