Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

By symbol match improvements #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

roxanebellot
Copy link
Contributor

Hi !

This may be out of nowhere, but playing around with your lib, and found the "heuristic" in by_symbol_match could be significantly improved by using a regex to avoid finding currency symbols in words.
This both improves the detection of the right currency and reduces the detection of bad currencies !

For reference, I also added a little case-insensitivness test case :)

Yesterday, I was so overhyped I created #10 that was not ready. Github won't let me re-open it because if was force-pushed ☹️

Comment on lines 203 to 205
symbol_pattern = symbol
symbol_pattern = symbol_pattern.replace("$", r"\$") # $ means endline
symbol_pattern = symbol_pattern.replace(".", r"\.") # . means anything
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of escaping special characters by hand please use the re.escape function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I did not know that 👍

@tammoippen
Copy link
Owner

Thank you for your interest in this project. There is just this minor request i have, then we are good for merge. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants