summary refs log tree commit diff
path: root/numberparser.py
AgeCommit message (Collapse)Author
2016-01-02Update copyright for 2016Clayton G. Hobbs
2016-01-02Rewrote NumberParser.parse_all_numbers()Clayton G. Hobbs
Its control flow was confusing before; now it's much more straightforward. We make a string representing classes of words, split that by a regular expression for number words, then parse each number and build up our return string and list. It works just as well as the previous method, is a bit shorter, and I feel that it's clearer as well.
2015-12-30Fixed the guaranteed-dictionary-update bugClayton G. Hobbs
It wasn't actually guaranteed, it turns out. I was iterating over dictionary keys, which is done in arbitrary order. The result was that in different executions of the program, the corpus was generated differently, so the hashes differed, and the language had to be updated. Sorting the keys before adding them to the list of number-words fixed the problem.
2015-12-30Added number parsing capabilitiesClayton G. Hobbs
See commands.tmp for an example. It's pretty neat, but it could still use some work. I thought of a really clever way to parse numbers, better than the one I came up with last night, but since I have a working implementation now I figure I'd better commit it. We have a new bug which causes the dictionary to be updated every time the program starts. I hope I didn't force that to happen last night or something, but I have a vague feeling I did.