Commit 694f81e7 authored by 李小芳's avatar 李小芳

修改获取类型的逻辑

parent 8e865e4a
......@@ -14,13 +14,12 @@ from gm_rpcd.all import bind
QUERY_KEY = "query:{}:set"
LABEL_VALUE = {
MIND_TYPE.PROJECT: 8,
MIND_TYPE.HOSPITAL: 7,
MIND_TYPE.DOCTOR: 6,
MIND_TYPE.FREE_FACE: 4,
MIND_TYPE.FACE: 3,
MIND_TYPE.AREA: 2,
MIND_TYPE.USER: 1,
# MIND_TYPE.SCHEME: 6,
MIND_TYPE.PROJECT: 5,
MIND_TYPE.DOCTOR: 4,
MIND_TYPE.HOSPITAL: 3,
MIND_TYPE.FREE_FACE: 2,
MIND_TYPE.FACE: 1,
MIND_TYPE.UNKNOWN: 0
}
......@@ -294,3 +293,20 @@ def get_tips_word_type(query=''):
labels.append(MIND_TYPE.PROJECT)
labels.sort(key=label_key, reverse=True)
return labels[0]
def query_inference(query=''):
try:
query_old_key = "query_type_set:{}"
##正常判断
labels = list()
key = query_old_key.format(query)
labels = list(map(lambda x: x.decode("utf8"), list(redis_client.smembers(key))))
labels.append(MIND_TYPE.UNKNOWN)
if query in QUERY_WORD_LABEL_NEED_MODIFIED:
labels.append(MIND_TYPE.PROJECT)
labels.sort(key=label_key, reverse=True)
return {'label': labels[0]}
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return {'label': MIND_TYPE.UNKNOWN}
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 to comment