Skip to content

Commit

Permalink
fix full width to half width numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsumoto-ren committed Aug 6, 2024
1 parent 9b66520 commit 2134eb8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions merge_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import itertools
import re
import unicodedata
from typing import Any
from collections.abc import Sequence, Iterator, Iterable
from typing import Any

from anki import collection
from anki.cards import Card, CardId
Expand All @@ -25,6 +25,8 @@
# Utils
######################################################################

NUMBERS = str.maketrans("0123456789", "0123456789")


def strip_html(s: str) -> str:
return strip_html_media(s).strip()
Expand All @@ -38,7 +40,7 @@ def strip_punctuation(s: str) -> str:


def full_width_to_half_width(s: str) -> str:
return unicodedata.normalize("NFKC", s)
return unicodedata.normalize("NFKC", s).translate(NUMBERS)


def remove_furigana(s: str):
Expand Down

0 comments on commit 2134eb8

Please sign in to comment.