Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
search_tips
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
search_tips
Commits
694f81e7
Commit
694f81e7
authored
Aug 12, 2020
by
李小芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改获取类型的逻辑
parent
8e865e4a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
words_utils.py
trans2es/commons/words_utils.py
+23
-7
No files found.
trans2es/commons/words_utils.py
View file @
694f81e7
...
...
@@ -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
}
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