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
7f822758
Commit
7f822758
authored
Feb 11, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增热搜词
parent
6e57caf2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
6 deletions
+9
-6
commons.py
trans2es/commons/commons.py
+7
-2
wordresemble.py
trans2es/models/wordresemble.py
+0
-2
type_info.py
trans2es/type_info.py
+1
-1
search_query.py
trans2es/utils/search_query.py
+1
-1
No files found.
trans2es/commons/commons.py
View file @
7f822758
...
@@ -18,9 +18,9 @@ def uuid4():
...
@@ -18,9 +18,9 @@ def uuid4():
return
uuid
.
uuid4
()
.
hex
return
uuid
.
uuid4
()
.
hex
def
get_tips_suggest_list
(
instance_cn_name
):
def
get_tips_suggest_list
(
instance_cn_name
,
is_weighting
=
False
):
try
:
try
:
print
(
instance_cn_name
)
# ch_full_weight = 6.0 * 1000
# ch_full_weight = 6.0 * 1000
# py_full_weight = 3.0 * 1000
# py_full_weight = 3.0 * 1000
full_weight
=
3.0
*
1000
full_weight
=
3.0
*
1000
...
@@ -33,6 +33,11 @@ def get_tips_suggest_list(instance_cn_name):
...
@@ -33,6 +33,11 @@ def get_tips_suggest_list(instance_cn_name):
# 命中开始部分加权
# 命中开始部分加权
begin_prefix_weight
=
1.2
*
1000
begin_prefix_weight
=
1.2
*
1000
if
is_weighting
:
begin_prefix_weight
=
1.2
full_weight
=
3.0
py_acronym_full_weight
=
3.0
ch_full_word
=
instance_cn_name
.
strip
()
ch_full_word
=
instance_cn_name
.
strip
()
py_full_word
=
''
.
join
(
lazy_pinyin
(
ch_full_word
))
py_full_word
=
''
.
join
(
lazy_pinyin
(
ch_full_word
))
py_acronym_full_word
=
''
.
join
(
lazy_pinyin
(
ch_full_word
,
style
=
pypinyin
.
FIRST_LETTER
))
py_acronym_full_word
=
''
.
join
(
lazy_pinyin
(
ch_full_word
,
style
=
pypinyin
.
FIRST_LETTER
))
...
...
trans2es/models/wordresemble.py
View file @
7f822758
...
@@ -14,8 +14,6 @@ from django.utils import timezone
...
@@ -14,8 +14,6 @@ from django.utils import timezone
from
gm_upload
import
IMG_TYPE
,
ImgUrlField
from
gm_upload
import
IMG_TYPE
,
ImgUrlField
from
gm_types.gaia
import
WORDREL_CATEGORY
from
gm_types.gaia
import
WORDREL_CATEGORY
doris_manager
=
lambda
:
models
.
Manager
()
.
db_manager
(
using
=
'doris'
)
class
WordRel
(
models
.
Model
):
class
WordRel
(
models
.
Model
):
class
Meta
:
class
Meta
:
...
...
trans2es/type_info.py
View file @
7f822758
...
@@ -377,7 +377,7 @@ def get_type_info_map():
...
@@ -377,7 +377,7 @@ def get_type_info_map():
get_data_func
=
SearchWord
.
get_search_query
,
get_data_func
=
SearchWord
.
get_search_query
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
round_insert_period
=
2
,
round_insert_period
=
2
),
),
# TypeInfo(
# TypeInfo(
# name='suggest-v1',
# name='suggest-v1',
...
...
trans2es/utils/search_query.py
View file @
7f822758
...
@@ -34,7 +34,7 @@ class SearchWord(object):
...
@@ -34,7 +34,7 @@ class SearchWord(object):
item_dict
[
"offline_score"
]
=
0.0
item_dict
[
"offline_score"
]
=
0.0
item_dict
[
"tips_name_type"
]
=
5
item_dict
[
"tips_name_type"
]
=
5
ret_list
.
append
(
item_dict
)
ret_list
.
append
(
item_dict
)
suggest_list
=
get_tips_suggest_list
(
str
(
instance
.
keyword
)
.
lower
())
suggest_list
=
get_tips_suggest_list
(
str
(
instance
.
keyword
)
.
lower
()
,
is_weighting
=
True
)
return
(
item_dict
,
suggest_list
)
return
(
item_dict
,
suggest_list
)
except
:
except
:
...
...
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