For example, given the text - "home price went up from 500 thousands to two millions". Is there an easy way, in Python, to get the two numbers - 500,000 and 2,000,000?
Asked
Active
Viewed 84 times
-4
-
Search for NER within NLP – Celius Stingher Apr 08 '22 at 20:26
-
Please share a sample code of your question – Bruno Apr 08 '22 at 20:26
-
Look into [regular expressions](https://docs.python.org/3/library/re.html) – Robert Apr 08 '22 at 21:02
1 Answers
0
One way to go about this can be to extract all the numbers and the immediate words next to them so e.g. [500, thousands] or [1.5, millions]. You can do this with a regex. Next, you convert the second string to its numerical value and multiply it with the first number to get the full numerical equivalent. You can have a look at this answer for some ways to do that.

chomprrr
- 406
- 4
- 15