优化连续追问的报价条件与订单指代
This commit is contained in:
@@ -29,6 +29,7 @@ STATUSES = (('头程订单已完成','COMPLETED'),('已完成','COMPLETED'),('
|
||||
('processing','PROCESSING'))
|
||||
NOUN = r'订单|运单|入仓码|入仓号|\borders?\b|\bshipments?\b'
|
||||
COUNT = r'多少|几(?:个|票|条|张|笔)|总数|数量|总量|统计|数一下|(?:订单|运单)数(?!量)|\bhow\s+many\b|\bcount\b|\bnumber\b|\btotal\b'
|
||||
CONDITION = r'异常|\b(?:exception|abnormal)\b|'+'|'.join(pattern for _,pattern in NODE_PHRASES)+'|'+'|'.join(re.escape(phrase) for phrase,_ in STATUSES)
|
||||
|
||||
|
||||
def parse_query(message,listing=False):
|
||||
@@ -36,8 +37,7 @@ def parse_query(message,listing=False):
|
||||
message=re.sub(r'^(?:或者|那么|那)[,,\s]*','',message)
|
||||
message=re.sub(r'^(?:当前|目前|现在)[,,\s]+','',message)
|
||||
has_noun=bool(re.search(NOUN,message,re.I))
|
||||
condition=r'异常|\b(?:exception|abnormal)\b|'+'|'.join(pattern for _,pattern in NODE_PHRASES)+'|'+'|'.join(re.escape(phrase) for phrase,_ in STATUSES)
|
||||
if not has_noun and (listing or not re.search(COUNT,message,re.I) or not re.search(condition,message,re.I)):
|
||||
if not has_noun and (listing or not re.search(COUNT,message,re.I) or not re.search(CONDITION,message,re.I)):
|
||||
return None
|
||||
if not listing and not (re.search(COUNT,message,re.I) or re.search(r'分布|(?:都|分别).*到哪',message)):return None
|
||||
if re.search(r'公斤|千克|\bkg\b|重量|毛重|体积|件数|箱数|运费|费用|价格|多少钱',message,re.I):return None
|
||||
|
||||
Reference in New Issue
Block a user