in reply to Re^2: Parsing human notations of numbers
in thread Parsing human notations of numbers

I just checked Lingua::EN::Numericalize, and found that it doesn't properly support fractions either. "Three fourths" parses as 12... which is actually 3*4. That seems kinda wierd, but thems the breaks.


Dave

  • Comment on Re^3: Parsing human notations of numbers

Replies are listed 'Best First'.
Re^4: Parsing human notations of numbers
by nothingmuch (Priest) on Jan 16, 2005 at 07:47 UTC
    I think I will try to use Lingua::EN::Words2Nums in conjunction with Math::Expr to create atoms of a string that looks like "1/4" out of "one fourth", which it seems that it can do, and evaluate that string as an expression. I might even be tempted to just eval it, but i'm not sure about that, as it is user data.

    -nuffin
    zz zZ Z Z #!perl

      If you're going to just eval it, first make sure you've got only numbers, and second, make sure the user didn't give a fraction with zero as the denominator. :)


      Dave