Commit 4a7088ad by lichenggang

pre_judge

parent 65e6e41f
Showing with 9 additions and 1 deletions
......@@ -2,6 +2,7 @@
# -*- coding:utf-8 -*-
from predict.base_handler import BasePredictor
from static_config import *
from utils.functions import pre_judge
def fun(seri):
......@@ -156,6 +157,12 @@ class DicPredict(BasePredictor):
if result == 'param':
if BasePredictor.get_nan_rate(dic_data[k]) >= PARAM_NAN_RATE:
continue
if result in ('goods_name', 'brand'):
li_prejudge = ['?' if not pre_judge(str(single)) else single for single in dic_data[k]]
if BasePredictor.get_nan_rate(li_prejudge) >= PARAM_NAN_RATE:
continue
temp_pre_model_res[k] = EN_TO_ZH_MAP[result]
not_null_dic_data = {k: list(filter(lambda x: x != BasePredictor.PLACEHOLDER, dic_data[k])) for k in
......
......@@ -6,6 +6,7 @@ from urllib.parse import unquote
import tornado.web
import tornado.ioloop
from utils.functions import pre_judge
from utils.redis_cli import redis_cli
from predict.kw_predict import KwPredict
......@@ -31,7 +32,7 @@ class KwHandler(tornado.web.RequestHandler):
else:
code = 1
res = {}
if len(target) == 1 or target.isdigit() or len(target) >= 50:
if pre_judge(target):
score = 0
elif target in brand_set:
score = 1
......
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