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
34016db7
authored
Jan 18, 2021
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
valid_server 单独抽离参数判断
parent
bbacc1f0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
valid_server.py
valid_server.py
View file @
34016db7
...
...
@@ -56,19 +56,25 @@ class KwHandler(tornado.web.RequestHandler):
list_data
=
json
.
loads
(
self
.
request
.
body
)
dic_res
=
{}
for
kw
in
list_data
:
if
len
(
kw
)
<=
2
:
dic_res
[
kw
]
=
0
dic_res
[
kw
]
=
self
.
judge
(
kw
)
self
.
write
({
'status'
:
1
,
'result'
:
dic_res
})
def
judge
(
self
,
kw
):
if
len
(
kw
)
<=
2
:
return
0
elif
self
.
pat
.
findall
(
kw
):
dic_res
[
kw
]
=
1
return
1
else
:
res1
=
self
.
predic
.
predict
(
kw
,
'gn'
)
res2
=
self
.
predic
.
predict
(
kw
,
'param'
)
if
res1
[
'result'
]
==
1
or
res2
[
'result'
]
==
1
:
dic_res
[
kw
]
=
1
return
1
else
:
dic_res
[
kw
]
=
0
self
.
write
({
'status'
:
1
,
'result'
:
dic_res
})
return
0
def
gen_app
():
return
tornado
.
web
.
Application
(
handlers
=
[(
k
,
v
)
for
k
,
v
in
register_tornado_handlers
.
items
()])
...
...
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