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

modify

parent 7cf272a6
......@@ -130,6 +130,7 @@ class TypeInfo(object):
}
suggest_dict["suggest_type"] = suggest_item["suggest_type"]
suggest_dict["offline_score"] = suggest_item["word_weight"]
suggest_dict["id"] = suggest_dict["id"] + "_" + str(suggest_item["cur_index"])
data_list.append(suggest_dict)
except Exception:
traceback.print_exc()
......
......@@ -42,6 +42,7 @@ class DoctorTransfer(object):
py_full_word = ''.join(lazy_pinyin(ch_full_word))
py_acronym_full_word = ''.join(lazy_pinyin(ch_full_word,style=pypinyin.FIRST_LETTER))
cur_index = 0
#中文
for i in range(len(ch_full_word)):
for j in range(i,len(ch_full_word)+1):
......@@ -52,8 +53,10 @@ class DoctorTransfer(object):
suggest_item = {
"input":[ch_name_term],
"word_weight":(1.0*len(ch_name_term)/len((ch_full_word))) * prefix_weight,
"suggest_type": suggest_type
"suggest_type": suggest_type,
"cur_index": cur_index
}
cur_index += 1
suggest_list.append(suggest_item)
#拼音
......@@ -66,8 +69,10 @@ class DoctorTransfer(object):
suggest_item = {
"input":[py_name_term],
"word_weight":(1.0*len(py_name_term)/len(py_full_word)) * prefix_weight,
"suggest_type": suggest_type
"suggest_type": suggest_type,
"cur_index": cur_index
}
cur_index += 1
suggest_list.append(suggest_item)
#简写
......@@ -80,8 +85,10 @@ class DoctorTransfer(object):
suggest_item = {
"input":[py_acronym_term],
"word_weight":(1.0*len(py_acronym_term)/len(py_acronym_full_word)) * prefix_weight,
"suggest_type": suggest_type
"suggest_type": suggest_type,
"cur_index": cur_index
}
cur_index += 1
suggest_list.append(suggest_item)
return (item_dict,suggest_list)
......
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