numerizer icon indicating copy to clipboard operation
numerizer copied to clipboard

Include 'an's along with 'a's as an article

Open dhruvkb opened this issue 4 years ago • 3 comments

Problem

In many places the indefinite article 'a' is manipulated, either by stripping it away or treating it as 1. The article 'an' should be processed in the same way.

In all these regexes a should be replaced with an? to cover both articles.

Occurrences

https://github.com/jduff/numerizer/blob/31c1b1f32cc446be50ca6d3b735fe73fd867b466/lib/providers/english_provider.rb#L110 https://github.com/jduff/numerizer/blob/31c1b1f32cc446be50ca6d3b735fe73fd867b466/lib/providers/english_provider.rb#L124 https://github.com/jduff/numerizer/blob/31c1b1f32cc446be50ca6d3b735fe73fd867b466/lib/providers/english_provider.rb#L126

Resolution

I could make a PR if there's consensus that this needs to be fixed.

dhruvkb avatar Jan 10 '21 12:01 dhruvkb

Can you give a few examples of the test cases you would make pass with this change? I can't think of the cases where you would have an instead of a and want it treated the same way. I also haven't spent much time with this codebase in awhile now so may just be missing the context for this.

jduff avatar Jan 18 '21 14:01 jduff

Sure, I can give some examples.

Words Numerized
an eighth 1/8
an eleventh 1/11

You wouldn't use "a" as the article on words starting with vowels.

dhruvkb avatar Jan 20 '21 02:01 dhruvkb

I forgot about fractions lol.

If you want to submit a PR for this I'll take a look, thanks!

jduff avatar Jan 29 '21 17:01 jduff