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
036e5d48
authored
Mar 11, 2021
by
陈森彬
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加单对带K的参数转换
parent
0065abee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
utils/functions.py
valid_server.py
utils/functions.py
View file @
036e5d48
...
...
@@ -269,6 +269,30 @@ def check_param_r(kw):
return
check_res
def
check_param_k
(
kw
):
"""
确认是不是单独K结尾
:param kw:
:return:
"""
if
"K"
not
in
kw
.
upper
():
return
False
else
:
check_res
=
kw
.
upper
()
.
split
(
"K"
)
if
check_res
[
1
]
and
check_res
[
1
]
not
in
split_char
:
return
False
if
check_res
[
0
]
.
isdigit
()
or
"."
in
check_res
[
0
]:
if
"."
in
check_res
[
0
]:
res
=
str
(
delete_extra_zero
(
float
(
check_res
[
0
])
*
1000
))
+
"Ω"
else
:
res
=
str
(
int
(
check_res
[
0
])
*
1000
)
+
"Ω"
else
:
return
False
return
res
def
get_unit
(
unit_list
):
unit_str
=
""
for
u_str
in
unit_list
:
...
...
valid_server.py
View file @
036e5d48
...
...
@@ -7,7 +7,7 @@ import tornado.web
import
tornado.ioloop
from
utils.functions
import
pre_judge
,
word_conversion
,
cut_params
,
check_param
,
unit_conversion
,
get_not_exist_list
,
\
check_encap
,
check_temp
,
check_symbol
,
check_param_r
check_encap
,
check_temp
,
check_symbol
,
check_param_r
,
check_param_k
from
utils.redis_cli
import
redis_cli
from
predict.kw_predict
import
KwPredict
...
...
@@ -122,20 +122,24 @@ class UCHandler(tornado.web.RequestHandler):
attrs_list
.
append
(
res_data
)
old_attrs_list
.
append
(
param
)
else
:
res_data
=
unit_conversion
(
unit_res
,
param
)
res_data
=
unit_conversion
(
unit_res
,
param
)
# 没有中文的参数转换
if
res_data
:
attrs_list
.
append
(
res_data
)
old_attrs_list
.
append
(
param
)
cut_list
=
cut_params
(
kw
)
cut_list
=
cut_params
(
kw
)
# 根据符号,强制切割
unknown_list
=
get_not_exist_list
(
old_attrs_list
,
cut_list
)
for
kw_info
in
unknown_list
:
if
kw_info
:
if
check_temp
(
kw_info
):
if
check_temp
(
kw_info
):
# 确认是不是温漂系数
attrs_list
.
append
(
kw_info
)
elif
check_param_r
(
kw_info
):
elif
check_param_r
(
kw_info
):
# 确认是不是简写R/r
attrs_list
.
append
(
check_param_r
(
kw_info
)[
0
])
else
:
encap_res
=
check_encap
(
kw_info
)
k_res
=
check_param_k
(
kw_info
)
# 确认是不是单独K结尾
if
k_res
:
attrs_list
.
append
(
k_res
)
continue
encap_res
=
check_encap
(
kw_info
)
# 确认是不是封装
if
encap_res
:
encap_list
.
append
(
encap_res
)
...
...
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