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
c3a3f1ff
Commit
c3a3f1ff
authored
Jan 16, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
7cf272a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
type_info.py
trans2es/type_info.py
+1
-0
doctor_transfer.py
trans2es/utils/doctor_transfer.py
+10
-3
No files found.
trans2es/type_info.py
View file @
c3a3f1ff
...
...
@@ -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
()
...
...
trans2es/utils/doctor_transfer.py
View file @
c3a3f1ff
...
...
@@ -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
)
...
...
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