Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
9d46382b
Unverified
Commit
9d46382b
authored
Aug 31, 2021
by
Leo Gao
Committed by
GitHub
Aug 31, 2021
Browse files
Move jieba and nagisa imports into their respective functions
parent
13710677
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
lm_eval/tasks/translation.py
lm_eval/tasks/translation.py
+2
-2
No files found.
lm_eval/tasks/translation.py
View file @
9d46382b
...
...
@@ -5,8 +5,6 @@ from lm_eval import metrics
from
lm_eval.base
import
Task
,
rf
from
typing
import
List
import
jieba
import
nagisa
"""
...
...
@@ -41,10 +39,12 @@ def create_tasks_from_benchmarks(benchmark_dict):
def
zh_split
(
zh_text
:
List
[
str
])
->
List
[
str
]:
"""Chinese splitting"""
import
jieba
return
[
" "
.
join
(
jieba
.
cut
(
txt
.
strip
()))
for
txt
in
zh_text
]
def
ja_split
(
ja_text
:
List
[
str
])
->
List
[
str
]:
"""Japanese splitting"""
import
nagisa
return
[
" "
.
join
(
nagisa
.
tagging
(
txt
.
strip
()).
words
)
for
txt
in
ja_text
]
NO_SPACE_LANG
=
{
"zh"
:
zh_split
,
"ja"
:
ja_split
}
...
...
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