-
Notifications
You must be signed in to change notification settings - Fork 50
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
Returning currency without price #12
Comments
I think option 1 is the way to go. We just need to improve the regular expressions that we use to match currencies so that "Europa" does not count as "EUR". |
What about single letter currencies? Do the same? In [1]: Price.fromstring("SOMETHING R SOMETHING") In [1]: Price.fromstring("SOMETHING WORD SOMETHING") |
I think so. When a real-life scenario comes up where this is troublesome, we can look into improvements to solve or mitigate such issues. For example, ignore specific currency expressions on specific locales (I assume we are getting locale support à la dateparser eventually), such as ignoring "R" on languages where "R" is a common word and they always use a different text when referring to the "R" currency. |
I think a price is a combination of currency and value. My concern is that, as it is a specific case, it could be in a place specific for currency parsing from a string, instead of returning a price without value. |
This is not very constructive, I know.. Just an observation: converting HTML to text is a tricky problem, which may require a full browser to do properly; e.g. depending on a website, a whitespace should or shouldn't be inserted around |
I think instead of relying on whitespaces completely, it will be good to check that the currency's string ( eg:
because there is " O " after EUR
I also agree with the @kmike tags in HTML will mostly surround the strings.
In the above example, EUR is not surrounded by any alphabet, it is surrounded by |
I think the input to price-parser should not include HTML tags, I think the user it meant to clean that up before passing the input to number-parser. I think @kmike’s point is that, when a user does that clean up, the result may not have those spaces. I’m thinking for example of |
Does it makes sense to return a Price instance with currency set and without a price value?
Actually if we have a substring inside a string that matches with an existing currency, it will be returned even if we are not mentioning the currency:
This happens because we use regexes to match the currencies inside a string. But this approach would create a problem when single-letter currencies is handled better (#3) .
I can see two options to handle this scenario:
The text was updated successfully, but these errors were encountered: