cannawen / metric_units_reddit_bot

Reddit bot converting imperial units to metric units
https://www.reddit.com/user/metric_units
GNU General Public License v3.0
78 stars 34 forks source link

Allow for k to represent thousand [#151447001] #46

Closed nicolasferraro closed 6 years ago

nicolasferraro commented 6 years ago

i.e. 50k miles should be processed to 50000 miles

A quick solution for this would be to add k matching to the number_regex so when we are parsing 50k we match 50k instead of 50 like we do currently. We could then either replace the k with 000 or cast the string as a number and multiply it by 1000.

@cannawen What's your opinion on this? Should we also parse numbers like 20.2k to 20200?

I would like to work on this.

cannawen commented 6 years ago

If you wait for PR #44 to be merged in (some time within the next few days probably), there will be a nice "preprocess comment" method you can use! Yes, I think changing 20.2k to 20200 would make sense :)

Thanks for volunteering to pick up this task!

nalinbhardwaj commented 6 years ago

Similarly, it should be easy to add modifiers like thousand, m, b, mill, billion and so on. This could also be a good start to adding interpretation of word numbers fifty five and so on.

cannawen commented 6 years ago

That's a great idea! Maybe once the we get the "preprocess" code in, we could create some separate stories to add those modifiers and word-numbers as well :)

cannawen commented 6 years ago

@nalinbhardwaj The preprocess change was just merged in FYI, so the infrastructure should be there for you to start working on this issue

nalinbhardwaj commented 6 years ago

@cannawen did you mean to mention @nicoferraro96 ? Isn't this already assigned to him?

cannawen commented 6 years ago

MY BAD, yes, sorry!!

nicolasferraro commented 6 years ago

@cannawen Cool, I'll start working on it later today!

cannawen commented 6 years ago

Hey @nicoferraro96, we have just added a CONTRIBUTING.md doc, please check it out when you have time! Sections "Etiquette", "Work on an issue" and "Make a PR" are most important