diff --git a/.github/workflows/release_all.yml b/.github/workflows/release_all.yml index 4a25fa5..55e54b1 100644 --- a/.github/workflows/release_all.yml +++ b/.github/workflows/release_all.yml @@ -62,7 +62,7 @@ jobs: run: | source .venv/bin/activate && uv pip list && - python ./bin/convert_all.py --input_folder=$INPUT_DIR --output_folder=$OUTPUT_DIR --extension=tab --filter=Hero + uv run python ./bin/convert_all.py --input_folder=$INPUT_DIR --output_folder=$OUTPUT_DIR --extension=tab --filter=Hero - name: Report the results run: | diff --git a/.github/workflows/release_all_external.yml b/.github/workflows/release_all_external.yml index 5e448ef..81f8941 100644 --- a/.github/workflows/release_all_external.yml +++ b/.github/workflows/release_all_external.yml @@ -68,7 +68,7 @@ jobs: run: | source .venv/bin/activate && uv pip list && - python ./bin/convert_all.py --input_folder=$INPUT_DIR --output_folder=$OUTPUT_DIR --extension=tab --filter=Hero + uv run python ./bin/convert_all.py --input_folder=$INPUT_DIR --output_folder=$OUTPUT_DIR --extension=tab --filter=Hero - name: Report the results run: | diff --git a/Makefile b/Makefile index 86cdb57..6f180d3 100644 --- a/Makefile +++ b/Makefile @@ -6,3 +6,7 @@ all: cp -r dict/* ext-dict/ uv run python ./bin/convert_all.py --input_folder=ext-dict --output_folder=ext-output --extension=tab echo "Release all" + +test: + echo "Run test the venv" + uv run python ./bin/test.py diff --git a/bin/test.py b/bin/test.py index 9980c13..8d0bcea 100644 --- a/bin/test.py +++ b/bin/test.py @@ -1,4 +1,5 @@ from iso_language_codes import language_name +import langcodes import pinyin_jyutping_sentence import os @@ -11,6 +12,10 @@ print(language_name("vi")) print(language_name("zh")) +print(langcodes.Language.get("vi").display_name("vi")) +print(langcodes.Language.get("zh").display_name("vi")) + + s="我们还可以再见面吗?" print(s) @@ -20,35 +25,3 @@ print(f"pinyin.get: {getpinyin(s)}") -import jieba - -from pypinyin_dict.phrase_pinyin_data import cc_cedict -cc_cedict.load() - -# 使用 pinyin-data 项目中 kXHC1983.txt 文件中的拼音数据优化结果 -from pypinyin_dict.pinyin_data import kxhc1983 -kxhc1983.load() - -def get_word_pinyin(sentences): - - words = list(jieba.cut(sentences)) - - pinyins = [pypinyin.pinyin(word, heteronym=True) for word in words] - - pinyintext = " ".join(["".join([item[0] for item in pinyin]) for pinyin in pinyins]) - return pinyintext - -def get_word_pinyin_dragon(sentences): - - return hanzi.to_pinyin(' '.join(list(jieba.cut(sentences)))) - -print(f"get_word_pinyin: {get_word_pinyin(s)}") - -import jieba - -print(f"jieba") - -seg_list = jieba.cut_for_search(s) # 搜索引擎模式 -print(", ".join(seg_list)) - -print(f"get_word_pinyin_dragon: {get_word_pinyin_dragon(s)}")