|
@@ -30,8 +30,8 @@ def re_standard_ratio(_str):
|
|
left = _str[max(0,m_span[0]-15):m_span[0]]
|
|
left = _str[max(0,m_span[0]-15):m_span[0]]
|
|
right = _str[m_span[1]:m_span[1]+10]
|
|
right = _str[m_span[1]:m_span[1]+10]
|
|
context = left + keyword + right
|
|
context = left + keyword + right
|
|
- print(1,keyword)
|
|
|
|
- if not re.search("利率",context) and not re.search("^[万元]",right):
|
|
|
|
|
|
+ # print(1,keyword)
|
|
|
|
+ if not re.search("利率|保险",context) and not re.search("^[万元]",right):
|
|
ratio_list.append([keyword, keyword_index])
|
|
ratio_list.append([keyword, keyword_index])
|
|
|
|
|
|
return ratio_list
|
|
return ratio_list
|
|
@@ -74,8 +74,18 @@ def extract_ratio(text):
|
|
# if not re.search("[%‰]",word):
|
|
# if not re.search("[%‰]",word):
|
|
# continue
|
|
# continue
|
|
match_text = num_value
|
|
match_text = num_value
|
|
- num_value = float(re.sub('[((]|[%‰]','',num_value))
|
|
|
|
|
|
+ num_value = round(Decimal(re.sub('[((]|[%‰]','',num_value)),10)
|
|
|
|
+ # print(num_value)
|
|
|
|
+ # _num = str(num_value).split('.')[0]
|
|
|
|
+ if len(str(num_value).split('.'))<2:
|
|
|
|
+ continue
|
|
_decimal = str(num_value).split('.')[1]
|
|
_decimal = str(num_value).split('.')[1]
|
|
|
|
+ _decimal = re.sub("0+$","",_decimal)
|
|
|
|
+ # print(_decimal)
|
|
|
|
+ if _decimal=="":
|
|
|
|
+ _decimal = "0"
|
|
|
|
+ # num_value = float(_num+"."+_decimal)
|
|
|
|
+ # print(num_value)
|
|
if _decimal == '0':
|
|
if _decimal == '0':
|
|
round_len = 0
|
|
round_len = 0
|
|
else:
|
|
else:
|