Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
bom_identify
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4a7088ad
authored
Dec 29, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
pre_judge
parent
65e6e41f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
predict/dict_predict.py
valid_server.py
predict/dict_predict.py
View file @
4a7088ad
...
...
@@ -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
...
...
valid_server.py
View file @
4a7088ad
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment