Commit 5d2224c9 by 陈森彬

去掉R/r小数点后面的0

parent b4b0b6a7
Showing with 24 additions and 12 deletions
......@@ -189,6 +189,12 @@ def get_not_exist_list(attrs_list, cut_list):
def valid_encap(prefix, tail):
"""
检查封装
:param prefix:
:param tail:
:return:
"""
prefix_flag = False
tail_flag = False
......@@ -240,6 +246,11 @@ def check_symbol(kw):
def check_param_r(kw):
"""
确认是不是简写R/r
:param kw:
:return:
"""
check_res = r_pattern.findall(kw)
if not check_res:
check_res = False
......@@ -249,7 +260,7 @@ def check_param_r(kw):
if not check_res[0].isalpha() and not check_res[2].isalpha():
cut_list = re.split('[Rr]', check_res[1])
if not cut_list[0] and cut_list[1]:
new_list.append("0." + str(cut_list[1]) + "Ω")
new_list.append(str(delete_extra_zero(float("0." + str(cut_list[1])))) + "Ω")
elif cut_list[0] and not cut_list[1]:
new_list.append(str(cut_list[0]) + "Ω")
else:
......
......@@ -129,17 +129,18 @@ class UCHandler(tornado.web.RequestHandler):
cut_list = cut_params(kw)
unknown_list = get_not_exist_list(old_attrs_list, cut_list)
for kw_info in unknown_list:
if check_temp(kw_info):
attrs_list.append(kw_info)
elif check_param_r(kw_info):
attrs_list.append(check_param_r(kw_info)[0])
else:
encap_res = check_encap(kw_info)
if encap_res:
encap_list.append(encap_res)
if kw_info and check_symbol(kw_info) and not encap_res:
words_list.append(kw_info)
if kw_info:
if check_temp(kw_info):
attrs_list.append(kw_info)
elif check_param_r(kw_info):
attrs_list.append(check_param_r(kw_info)[0])
else:
encap_res = check_encap(kw_info)
if encap_res:
encap_list.append(encap_res)
if check_symbol(kw_info) and not encap_res:
words_list.append(kw_info)
res['status'] = 1
res['words'] = list(set(words_list))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment