Taizo Kaneko
commited on
Commit
·
7994919
1
Parent(s):
87191d1
commit files to HF hub
Browse files- mecab_tokenizer.py +6 -3
mecab_tokenizer.py
CHANGED
@@ -57,9 +57,12 @@ class MeCabTokenizer(PreTrainedTokenizer):
|
|
57 |
# 最初と最後は空文字
|
58 |
if result_word.hyosokei == "":
|
59 |
continue
|
60 |
-
if self.target_hinshi is not None
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
63 |
else:
|
64 |
out.append(result_word.hyosokei)
|
65 |
return out
|
|
|
57 |
# 最初と最後は空文字
|
58 |
if result_word.hyosokei == "":
|
59 |
continue
|
60 |
+
if self.target_hinshi is not None:
|
61 |
+
if result_word.hinshi in self.target_hinshi:
|
62 |
+
# 特定の品詞のみ返します。
|
63 |
+
out.append(result_word.hyosokei)
|
64 |
+
else:
|
65 |
+
continue
|
66 |
else:
|
67 |
out.append(result_word.hyosokei)
|
68 |
return out
|