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
8a37ba40
Commit
8a37ba40
authored
Mar 23, 2020
by
李小芳
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hot_search_word' into 'master'
add See merge request
!67
parents
e41e0d88
33fc0da1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
28 deletions
+37
-28
words_utils.py
trans2es/commons/words_utils.py
+37
-28
No files found.
trans2es/commons/words_utils.py
View file @
8a37ba40
# coding=utf8
from
__future__
import
unicode_literals
,
absolute_import
,
print_function
import
logging
import
traceback
import
json
from
libs.cache
import
redis_client
from
trans2es.models.query_word_conversion
import
TagConversion
,
DoctorConversion
,
HospitalConversion
from
trans2es.models.strategy_search_word
import
StrategyHistoryQueryWords
from
libs.cache
import
redis_client
import
base64
from
gm_types.doris
import
MIND_TYPE
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
.
UNKNOWN
:
0
}
QUERY_WORD_LABEL_NEED_MODIFIED
=
{
u"玻尿酸"
:
MIND_TYPE
.
PROJECT
,
u"鼻"
:
MIND_TYPE
.
PROJECT
,
u"眼"
:
MIND_TYPE
.
PROJECT
,
u"嘴"
:
MIND_TYPE
.
PROJECT
,
u"脱毛"
:
MIND_TYPE
.
PROJECT
}
class
TagTab
(
object
):
...
...
@@ -99,6 +123,18 @@ class QueryWordAttr(object):
@classmethod
def
get_hot_search_query_word_weight
(
cls
,
name
):
try
:
search_info
=
StrategyHistoryQueryWords
.
objects
.
filter
(
keyword
=
name
)
weight
=
0.01
*
(
search_info
.
search_num
*
0.5
+
0.5
*
(
search_info
.
answer_num
+
search_info
.
tractate_num
+
search_info
.
diary_num
))
return
weight
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
0.0
@classmethod
def
get_hot_search_query_word_weight_v1
(
cls
,
name
):
try
:
search_num
=
StrategyHistoryQueryWords
.
objects
.
filter
(
keyword
=
name
)
.
values_list
(
"search_num"
,
flat
=
True
)
.
first
()
...
...
@@ -252,33 +288,6 @@ class QueryWordAttr(object):
return
False
from
gm_rpcd.all
import
bind
from
libs.cache
import
redis_client
import
base64
from
gm_types.doris
import
MIND_TYPE
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
.
UNKNOWN
:
0
}
QUERY_WORD_LABEL_NEED_MODIFIED
=
{
u"玻尿酸"
:
MIND_TYPE
.
PROJECT
,
u"鼻"
:
MIND_TYPE
.
PROJECT
,
u"眼"
:
MIND_TYPE
.
PROJECT
,
u"嘴"
:
MIND_TYPE
.
PROJECT
,
u"脱毛"
:
MIND_TYPE
.
PROJECT
}
def
label_key
(
label
):
return
LABEL_VALUE
.
get
(
label
)
...
...
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