Commit bbacc1f0 by lichenggang

添加pre_judge function

parent 4a7088ad
Showing with 23 additions and 0 deletions
#!/usr/bin/env python
# -*- coding:utf-8 -*-
def is_float(s):
xiaoshu_new=str(s)
if xiaoshu_new.count(".") ==1:
left,right = xiaoshu_new.split(".")
if left.isdigit() and right.isdigit():
return True
elif left.startswith('-') and left.count('-') == 1 and right.isdigit():
lleft = left.split('-')[-1]
if lleft.isdigit():
return True
return False
def pre_judge(kw):
if is_float(kw) or len(kw) == 1 or kw.isdigit() or len(kw) >= 30:
return False
return True
\ No newline at end of file
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