Skip to content

Commit

Permalink
Merge pull request #90 from tpdn/fix/remove_mojimoji
Browse files Browse the repository at this point in the history
mojimojiを撤去する
  • Loading branch information
yagays authored Nov 4, 2023
2 parents 860330e + 6835921 commit e82a417
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 26 deletions.
6 changes: 3 additions & 3 deletions ja_timex/number_normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from dataclasses import dataclass
from typing import List, Tuple

import mojimoji

zero = {"零": 0}
zen2han = {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9}
char2int = {"〇": 0, "一": 1, "二": 2, "三": 3, "四": 4, "五": 5, "六": 6, "七": 7, "八": 8, "九": 9}
char2power_allow_head = {"十": 1, "百": 2, "千": 3}
char2power = {"万": 4, "億": 8, "兆": 12, "京": 16, "垓": 20}
char_int_table = str.maketrans({k: str(v) for k, v in char2int.items()})
zen_han_table = str.maketrans({k: str(v) for k, v in zen2han.items()})


@dataclass
Expand Down Expand Up @@ -133,7 +133,7 @@ def _normalize_zen_to_han(self, text: str) -> str:
Returns:
str: 半角に正規化した文字列
"""
text = mojimoji.zen_to_han(text, kana=False, ascii=False)
text = text.translate(zen_han_table)

# 数字の間にはいる,や.の全角文字を半角にする
re_match = re.search("[0-9][,.][0-9]", text)
Expand Down
22 changes: 0 additions & 22 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.8.1"
mojimoji = "^0.0.11"
pendulum = "^2.1.2"

[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit e82a417

Please sign in to comment.