Skip to content

Commit

Permalink
fix: #12 and ruby it
Browse files Browse the repository at this point in the history
Signed-off-by: yihong0618 <[email protected]>
  • Loading branch information
yihong0618 committed Jan 3, 2024
1 parent 5c6d4e4 commit f9ac88e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions epubhv/yomituki.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def hantei_chinese(word):
def hantei_cantonese(word):
# follow the old api for Chinese pinyin for cantonese
if word[1] is not None:
return word[0] + f"({word[1]})", False, None
return word[0], True, word[1] + ", "
else:
return word[0], False, None

Expand All @@ -123,13 +123,8 @@ def yomituki(sentence, lang="zh"):
words_list = tagger(sentence)
hantei = hantei_japanese
elif lang in ["cantonese"]:
text_list = get_jyutping_list(sentence)
text_list = [i[1] for i in text_list if i[1] is not None]
if text_list:
yield f"{sentence}({' '.join(text_list)})"
else:
yield sentence
return
words_list = get_jyutping_list(sentence)
hantei = hantei_cantonese
for text, ruby, yomi in map(hantei, words_list):
if ruby:
yield from cut_end(text, yomi)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "epubhv"
version = "0.5.1"
version = "0.5.2"
description = "make your epub books vertical or horizontal."
authors = [{ name = "yihong0618", email = "[email protected]" }]

Expand Down

0 comments on commit f9ac88e

Please sign in to comment.