Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Converting words to numbers with HOP::Parser

by Zaxo (Archbishop)
on Nov 05, 2005 at 21:46 UTC ( [id://506029]=note: print w/replies, xml ) Need Help??


in reply to Converting words to numbers with HOP::Parser

++Fun! It looks pretty easy to extend to "dozen", "score", and "gross".

After Compline,
Zaxo

  • Comment on Re: Converting words to numbers with HOP::Parser

Replies are listed 'Best First'.
Re^2: Converting words to numbers with HOP::Parser
by Ovid (Cardinal) on Nov 06, 2005 at 02:46 UTC

    I've been thinking about this and wondering about the grammar. It should be easy to extend, but is "one hundred and ten dozen" allowable? If so, it should equal "one hundren and six score", but both seem a bit odd.

    If you want a real challenge, try to add fractions. Should "three and nine-halves" be allowed? What about "one half million and thirteen hundred"? Mixing real numbers should probably be allowed, though. Allowing "3.5 million" seems sensible.

    Cheers,
    Ovid

    New address of my CGI Course.

      If so, it should equal "one hundren and six score", but both seem a bit odd.

      Or just "eleven score."

      I would think that, if dozen was used, it would be the highest denomination (and similarly for score.) So "one hundred and ten dozen" should probably be "eighteen dozen and four."

      Update: Then again, in deciding on what to accept as input, you should probably be liberal as possible and accept even bizarre things like "one thousand one hundred twenty score eight dozen and four" for 1500.

      -sauoq
      "My two cents aren't worth a dime.";
      

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://506029]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-25 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found