Skip to content

Commit

Permalink
Updates sourcesource
Browse files Browse the repository at this point in the history
  • Loading branch information
catusphan committed Dec 17, 2024
1 parent dcb8c5d commit c393343
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_all_external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
37 changes: 5 additions & 32 deletions bin/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from iso_language_codes import language_name
import langcodes

import pinyin_jyutping_sentence
import os
Expand All @@ -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)

Expand All @@ -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)}")

0 comments on commit c393343

Please sign in to comment.