codeforamerica / balance

A text message system for checking one's EBT card balance (SNAP benefits and more)
MIT License
47 stars 37 forks source link

Dollar amounts processor #344

Closed niklas closed 8 years ago

niklas commented 8 years ago

A quick test-driven implementation of the English language dollar amount parsing requested in #343 as a service object, so you can put in into your pipeline anywhere.

Might eat newlines included in numbers, but I guess that's expected.

daguar commented 8 years ago

Awesome! Thank you so much @niklas! I ran this through a broader sample to do some QA and found 2 additional edge cases not covered in the sample transcriptions I gave:

(1) It looks like single-digit cents amounts don't transcribe correctly right now

Example:

"Balance is twenty two dollars and eight cents. Your cash account balance is zero dollars and sixty eight cents. As a reminder..."

transcribes to

""Balance is $22.80. Your cash account balance is $0.68. As a reminder..."

(2) A SUPER SECRET DOUBLE-BONUS weird one of zero being transcribed to "the row"

Example:

"One moment please. OK. I've pulled up your account information. Your food stamp balance is the row. Dollars and forty two cents. You are"

If these are easy/interesting for you to try and cover @niklas that'd be great, otherwise I or someone else will try to modify for that.

Thanks so much again! I'm hoping to get the service back up today or tomorrow since this fix takes us ~95% of the way.

daguar commented 8 years ago

Thanks so much again @niklas! Will let you know when this is up and live again for folks!

niklas commented 8 years ago

I am very happy to help :wolf: