Skip to content

Commit

Permalink
Update and fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
felixonmars committed Jan 4, 2021
1 parent 85a94a8 commit 3df047a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=20201220
VERSION=20210101
FILENAME=zhwiki-$(VERSION)-all-titles-in-ns0

all: build
Expand Down
7 changes: 6 additions & 1 deletion convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
_HANZI_RE = re.compile('^[\u4e00-\u9fa5]+$')
_TO_SIMPLIFIED_CHINESE = opencc.OpenCC('t2s.json')

_PINYIN_FIXES = {
'n': 'en', # https://github.com/felixonmars/fcitx5-pinyin-zhwiki/issues/13
}

logging.basicConfig(level=logging.INFO)


Expand Down Expand Up @@ -61,7 +65,8 @@ def main():
for line in f:
title = _TO_SIMPLIFIED_CHINESE.convert(line.strip())
if is_good_title(title, previous_title):
pinyin = _PINYIN_SEPARATOR.join(lazy_pinyin(title))
pinyin = [_PINYIN_FIXES.get(item, item) for item in lazy_pinyin(title)]
pinyin = _PINYIN_SEPARATOR.join(pinyin)
if pinyin == title:
logging.info(
f'Failed to convert to Pinyin. Ignoring: {pinyin}')
Expand Down
2 changes: 1 addition & 1 deletion recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ recipe:
description: >-
Install zhwiki dict from fcitx5-pinyin-zhwiki
download_files: >-
zhwiki.dict.yaml::https://github.com/felixonmars/fcitx5-pinyin-zhwiki/releases/download/0.2.1/zhwiki-20201220.dict.yaml
zhwiki.dict.yaml::https://github.com/felixonmars/fcitx5-pinyin-zhwiki/releases/download/0.2.1/zhwiki-20210101.dict.yaml
install_files: >-
zhwiki.dict.yaml

0 comments on commit 3df047a

Please sign in to comment.