if any([unit in pattern[3] for unit in self.unit_present_list]):
replace_comma = re.sub(",", "", pattern[3])
amount = int(self.regex_object.unit_substitute(replace_comma))
else:
replace_comma = re.sub(",", "", pattern[3])
amount = int(replace_comma)
After Change
r")(?:\b|\.|\s)", flags=re.UNICODE | re.IGNORECASE)
for match in pattern.finditer(self.processed_text):
original, amount, unit = match.groups()
budget = {
"min_budget": 0,
"max_budget": 0,
"type": BUDGET_TYPE_NORMAL
}
scale = self.get_scale(unit)
if amount.replace(",", "").replace(".", "").isdigit():
amount = float(amount.replace(",", "")) * scale
amount = int(amount) // casting to int for backward compatibility
if self.min_digit <= len(str(amount)) <= self.max_digit:
budget["min_budget"] = amount