Skip to content

Commit 0a8c747

Browse files
committed
限制英文只有abcd
1 parent ed44e3e commit 0a8c747

2 files changed

Lines changed: 1 addition & 1 deletion

File tree

itn/chinese/rules/cardinal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def build_tagger(self):
172172
# 5. 添加"中文数字+英文字母"的规则,如"四a" -> "4a"
173173
# 匹配一个或多个英文字母(大小写)
174174
from pynini import union
175-
english_letters = union(*[accep(c) for c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"])
175+
english_letters = union(*[accep(c) for c in "abcdABCD"])
176176
# 数字+字母的组合,如"四a" -> "4a"
177177
number_with_letter = number + english_letters.plus
178178
cardinal |= add_weight(number_with_letter, 0.05) # 使用较高优先级

itn/zh_itn_tagger.fst

-17.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)