Commit beb9a2f1 authored by 段英荣's avatar 段英荣

modify bug

parent cc3c30e9
......@@ -32,7 +32,7 @@ def get_tips_suggest_list(instance_cn_name):
# 命中开始部分加权
begin_prefix_weight = 1.2 * 10000
ch_full_word = instance_cn_name
ch_full_word = instance_cn_name.strip()
py_full_word = ''.join(lazy_pinyin(ch_full_word))
py_acronym_full_word = ''.join(lazy_pinyin(ch_full_word, style=pypinyin.FIRST_LETTER))
......@@ -46,11 +46,11 @@ def get_tips_suggest_list(instance_cn_name):
prefix_weight = ch_prefix_weight if len(ch_name_term) != len(
ch_full_word) else ch_full_weight
suggest_type = 0 if len(ch_name_term) != len(ch_full_word) else 1
begin_prefix_weight = begin_prefix_weight if i == 0 else 1.0
term_begin_prefix_weight = begin_prefix_weight if i == 0 else 1.0
suggest_item = {
"input": [ch_name_term],
"word_weight": (1.0 * len(ch_name_term) / len(
(ch_full_word))) * prefix_weight * begin_prefix_weight,
(ch_full_word))) * prefix_weight * term_begin_prefix_weight,
"suggest_type": suggest_type,
"cur_index": cur_index
}
......@@ -65,11 +65,11 @@ def get_tips_suggest_list(instance_cn_name):
prefix_weight = py_prefix_weight if len(py_name_term) != len(
py_full_word) else py_full_weight
suggest_type = 2 if len(py_name_term) != len(py_full_word) else 3
begin_prefix_weight = begin_prefix_weight if i == 0 else 1.0
term_begin_prefix_weight = begin_prefix_weight if i == 0 else 1.0
suggest_item = {
"input": [py_name_term],
"word_weight": (1.0 * len(py_name_term) / len(
py_full_word)) * prefix_weight * begin_prefix_weight,
py_full_word)) * prefix_weight * term_begin_prefix_weight,
"suggest_type": suggest_type,
"cur_index": cur_index
}
......@@ -84,11 +84,11 @@ def get_tips_suggest_list(instance_cn_name):
prefix_weight = py_acronym_prefix_weight if len(py_acronym_term) != len(
py_acronym_full_word) else py_acronym_full_weight
suggest_type = 4 if len(py_acronym_term) != len(py_acronym_full_word) else 5
begin_prefix_weight = begin_prefix_weight if i == 0 else 1.0
term_begin_prefix_weight = begin_prefix_weight if i == 0 else 1.0
suggest_item = {
"input": [py_acronym_term],
"word_weight": (1.0 * len(py_acronym_term) / len(
py_acronym_full_word)) * prefix_weight * begin_prefix_weight,
py_acronym_full_word)) * prefix_weight * term_begin_prefix_weight,
"suggest_type": suggest_type,
"cur_index": cur_index
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment