scrapinghub / price-parser

Extract price amount and currency symbol from a raw text string
BSD 3-Clause "New" or "Revised" License
316 stars 50 forks source link

Parsing wrong price in presence of $ #62

Closed argaurav closed 1 year ago

argaurav commented 1 year ago

Hi,

I came across this example:

In [14]: Price.fromstring("2 pairs from $349", decimal_separator=".")
Out[14]: Price(amount=Decimal('2'), currency='$')

given we consider extracting currency as $ would it make sense to handle this case inside price parser?

argaurav commented 1 year ago

I have seen other examples like


In [15]: Price.fromstring("4 options from $439.34", decimal_separator=".")
Out[15]: Price(amount=Decimal('4'), currency='$')
Gallaecio commented 1 year ago

https://github.com/scrapinghub/price-parser/issues/2