reorganize
This commit is contained in:
@@ -7,17 +7,49 @@ from pinyin_tone_converter.pinyin_tone_converter import PinyinToneConverter
|
||||
|
||||
# from genanki import Deck, Note
|
||||
|
||||
# import argostranslate.package
|
||||
# import argostranslate.translate
|
||||
|
||||
## Constants
|
||||
|
||||
CCCEDICT = Path(__file__).parent / "cedict_ts.u8"
|
||||
DATA = Path(__file__).parent.parent / "data"
|
||||
INPUT = DATA / "input"
|
||||
OUTPUT = DATA / "output"
|
||||
CN = "cn"
|
||||
EN = "en"
|
||||
|
||||
## Classess
|
||||
|
||||
## Main
|
||||
|
||||
# Download and install Argos Translate package
|
||||
# argostranslate.package.update_package_index()
|
||||
# available_packages = argostranslate.package.get_available_packages()
|
||||
# package_to_install = next(
|
||||
# filter(
|
||||
# lambda x: x.from_code == CN and x.to_code == EN, available_packages
|
||||
# )
|
||||
# )
|
||||
# argostranslate.package.install_from_path(package_to_install.download())
|
||||
|
||||
def main():
|
||||
def process_files():
|
||||
print("Select data file:")
|
||||
files = []
|
||||
for n, file in enumerate(INPUT.glob('**/*.txt')):
|
||||
files.append(file)
|
||||
print(f"{n+1} - {file.relative_to(INPUT)}")
|
||||
s = None
|
||||
while not s or not s.isnumeric() or not (1 <= int(s) <= len(files)):
|
||||
s = input(f"Please select the file [1-{len(files)}]: ")
|
||||
in_file = files[int(s)-1]
|
||||
relative = in_file.relative_to(INPUT)
|
||||
out_file = OUTPUT / relative
|
||||
out_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
return in_file, out_file
|
||||
|
||||
def dictionary_process(in_file, out_file):
|
||||
"""Process dictionary files"""
|
||||
parser = CedictParser()
|
||||
parser.read_file(CCCEDICT)
|
||||
entries = parser.parse()
|
||||
@@ -29,15 +61,6 @@ def main():
|
||||
else:
|
||||
dictionary[entry.simplified].append(entry)
|
||||
|
||||
print("Select data file:")
|
||||
files = []
|
||||
for n, file in enumerate(DATA.glob('*.txt')):
|
||||
files.append(file)
|
||||
print(f"{n+1} - {file}")
|
||||
s = None
|
||||
while not s or not s.isnumeric() or not (1 <= int(s) <= len(files)):
|
||||
s = input(f"Please select the file [1-{len(files)}]: ")
|
||||
in_file = files[int(s)-1]
|
||||
out_file = DATA / f"{in_file.stem}.tsv"
|
||||
words_list = in_file.open(encoding="utf8").read().split()
|
||||
|
||||
@@ -75,6 +98,9 @@ def main():
|
||||
]
|
||||
)
|
||||
|
||||
def main():
|
||||
in_file, out_file = process_files()
|
||||
dictionary_process(in_file, out_file)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -1,299 +0,0 @@
|
||||
"1. affair; matter; thing; business
|
||||
2. CL:件[jian4],樁|桩[zhuang1]" shì qing 事情 事情
|
||||
1. complicated; complex fù zá 复杂 複雜
|
||||
"1. if
|
||||
2. in case
|
||||
3. in the event that" rú guǒ 如果 如果
|
||||
"1. to taste; to try (food)
|
||||
2. to experience
|
||||
3. (literary) ever; once" cháng 尝 嘗
|
||||
"1. flavor; taste
|
||||
2. (fig.) feeling (of ...); sense (of ...); hint (of ...)
|
||||
3. (fig.) interest; delight
|
||||
4. (dialect) smell; odor" wèi dao 味道 味道
|
||||
"1. to have to
|
||||
2. must
|
||||
3. compulsory
|
||||
4. necessarily" bì xū 必须 必須
|
||||
1. although; even though (often used correlatively with 可是[ke3 shi4] or 但是[dan4 shi4] etc) suī rán 虽然 雖然
|
||||
"1. all
|
||||
2. to have; to possess; to own" suǒ yǒu 所有 所有
|
||||
"1. satisfied
|
||||
2. pleased
|
||||
3. to one's satisfaction" mǎn yì 满意 滿意
|
||||
1. other people; others; other person bié ren 别人 別人
|
||||
1. to have no other option but to ...; to have to; to be forced to zhǐ hǎo 只好 只好
|
||||
"1. expert in
|
||||
2. good at" ná shǒu 拿手 拿手
|
||||
1. if (coming after a conditional clause) de huà 的话 的話
|
||||
"1. just now
|
||||
2. a moment ago" gāng cái 刚才 剛才
|
||||
1. to be in the process of (doing sth); to be currently ...-ing zhèng zài 正在 正在
|
||||
"1. to give a dinner party
|
||||
2. to entertain guests
|
||||
3. to invite to dinner" qǐng kè 请客 請客
|
||||
"1. holiday
|
||||
2. festival
|
||||
3. CL:個|个[ge4]" jié rì 节日 節日
|
||||
"1. tradition
|
||||
2. traditional
|
||||
3. convention
|
||||
4. conventional
|
||||
5. CL:個|个[ge4]" chuán tǒng 传统 傳統
|
||||
1. to have a holiday or vacation fàng jià 放假 放假
|
||||
"1. same
|
||||
2. ordinary
|
||||
3. so-so
|
||||
4. common
|
||||
5. general
|
||||
6. generally
|
||||
7. in general" yī bān 一般 一般
|
||||
"1. final; last; ultimate
|
||||
2. finally; in the end" zuì hòu 最后 最後
|
||||
"1. to congratulate
|
||||
2. congratulations
|
||||
3. CL:個|个[ge4]" zhù hè 祝贺 祝賀
|
||||
"1. (not only ...) but also
|
||||
2. moreover
|
||||
3. in addition
|
||||
4. furthermore" ér qiě 而且 而且
|
||||
1. young nián qīng 年轻 年輕
|
||||
"1. to plan
|
||||
2. to intend
|
||||
3. to calculate
|
||||
4. plan
|
||||
5. intention
|
||||
6. calculation
|
||||
7. CL:個|个[ge4]" dǎ suàn 打算 打算
|
||||
1. erhua variant of 一塊|一块[yi1 kuai4] yī kuài r5 一块儿 一塊兒
|
||||
"1. to leave (a message etc)
|
||||
2. to retain
|
||||
3. to stay
|
||||
4. to remain
|
||||
5. to keep
|
||||
6. to preserve" liú 留 留
|
||||
"1. to put in order
|
||||
2. to tidy up
|
||||
3. to pack
|
||||
4. to repair
|
||||
5. (coll.) to sort sb out
|
||||
6. to fix sb" shōu shi 收拾 收拾
|
||||
"1. to marry
|
||||
2. to get married
|
||||
3. CL:次[ci4]" jié hūn 结婚 結婚
|
||||
"1. horizontal; level
|
||||
2. a standard; a level (of ability, development etc)" shuǐ píng 水平 水平
|
||||
"1. to pass through; to get through
|
||||
2. to adopt (a resolution); to pass (legislation)
|
||||
3. to pass (a test)
|
||||
4. by means of; through; via" tōng guò 通过 通過
|
||||
1. to play a joke; to make fun of; to joke kāi wán xiào 开玩笑 開玩笑
|
||||
1. to depart; to leave lí kāi 离开 離開
|
||||
"1. opportunity
|
||||
2. chance
|
||||
3. occasion
|
||||
4. CL:個|个[ge4]" jī huì 机会 機會
|
||||
1. to continue; to proceed with; to go on with jì xù 继续 繼續
|
||||
"1. to raise
|
||||
2. to increase
|
||||
3. to improve" tí gāo 提高 提高
|
||||
"1. term
|
||||
2. semester
|
||||
3. CL:個|个[ge4]" xué qī 学期 學期
|
||||
"1. (express) thanks
|
||||
2. gratitude
|
||||
3. grateful
|
||||
4. thankful
|
||||
5. thanks" gǎn xiè 感谢 感謝
|
||||
"1. in the future
|
||||
2. future
|
||||
3. the future
|
||||
4. CL:個|个[ge4]" jiāng lái 将来 將來
|
||||
"1. several
|
||||
2. quite a few" hǎo jǐ 好几 好幾
|
||||
"1. to speak
|
||||
2. to talk
|
||||
3. to converse
|
||||
4. to chat
|
||||
5. to discuss" tán 谈 談
|
||||
"1. (romantic) love
|
||||
2. CL:個|个[ge4],場|场[chang3]
|
||||
3. in love
|
||||
4. to have an affair" liàn ài 恋爱 戀愛
|
||||
"1. to succeed
|
||||
2. success
|
||||
3. successful; fruitful" chéng gōng 成功 成功
|
||||
"1. but
|
||||
2. yet
|
||||
3. however
|
||||
4. while
|
||||
5. to go back
|
||||
6. to decline
|
||||
7. to retreat
|
||||
8. nevertheless
|
||||
9. even though" què 却 卻
|
||||
"1. indeed
|
||||
2. really
|
||||
3. reliable
|
||||
4. real
|
||||
5. true" què shí 确实 確實
|
||||
"1. result
|
||||
2. effect
|
||||
3. efficacy
|
||||
4. (theater) sound or visual effects" xiào guǒ 效果 效果
|
||||
"1. experience
|
||||
2. to go through; to experience" jīng yàn 经验 經驗
|
||||
"1. straight
|
||||
2. erect
|
||||
3. to stick out (a part of the body)
|
||||
4. to (physically) straighten up
|
||||
5. to support
|
||||
6. to withstand
|
||||
7. outstanding
|
||||
8. (coll.) quite
|
||||
9. very
|
||||
10. classifier for machine guns" tǐng 挺 挺
|
||||
"1. at least
|
||||
2. (to say the) least" zhì shǎo 至少 至少
|
||||
"1. condition; circumstance; term; factor
|
||||
2. requirement; prerequisite; qualification
|
||||
3. situation; state; condition
|
||||
4. CL:個|个[ge4]" tiáo jiàn 条件 條件
|
||||
"1. impression (sth that stays in one's mind)
|
||||
2. a memory" yìn xiàng 印象 印象
|
||||
"1. to wish
|
||||
2. to want
|
||||
3. ready
|
||||
4. willing (to do sth)" yuàn yì 愿意 願意
|
||||
"1. original; former
|
||||
2. originally; formerly; at first
|
||||
3. so, actually, as it turns out" yuán lái 原来 原來
|
||||
"1. capability
|
||||
2. ability
|
||||
3. CL:個|个[ge4]" néng lì 能力 能力
|
||||
"1. to earn
|
||||
2. to make a profit" zhuàn 赚 賺
|
||||
"1. to have to
|
||||
2. must
|
||||
3. ought to
|
||||
4. to need to" děi 得 得
|
||||
"1. to remind
|
||||
2. to call attention to
|
||||
3. to warn of" tí xǐng 提醒 提醒
|
||||
1. to believe; to be convinced; to accept as true xiāng xìn 相信 相信
|
||||
"1. to cheat
|
||||
2. to swindle
|
||||
3. to deceive
|
||||
4. to get on (a horse etc) by swinging one leg over" piàn 骗 騙
|
||||
"1. average; on average
|
||||
2. evenly; in equal proportions" píng jūn 平均 平均
|
||||
"1. common
|
||||
2. ordinary
|
||||
3. general
|
||||
4. average" pǔ tōng 普通 普通
|
||||
"1. interlinked
|
||||
2. connected
|
||||
3. communicating
|
||||
4. in communication
|
||||
5. accommodating" xiāng tōng 相通 相通
|
||||
1. always zǒng shì 总是 總是
|
||||
"1. ordinarily
|
||||
2. in normal times
|
||||
3. in peacetime" píng shí 平时 平時
|
||||
1. sudden; abrupt; unexpected tū rán 突然 突然
|
||||
1. hastily jí máng 急忙 急忙
|
||||
1. to pick up; to collect; to gather jiǎn 捡 撿
|
||||
"1. finger
|
||||
2. to point at or to
|
||||
3. to indicate or refer to
|
||||
4. to depend on
|
||||
5. to count on
|
||||
6. (of hair) to stand on end" zhǐ 指 指
|
||||
"1. careful; attentive; cautious
|
||||
2. to be careful; to look out
|
||||
3. (dialect) thrifty; frugal" zǐ xì 仔细 仔細
|
||||
"1. value
|
||||
2. (to be) worth
|
||||
3. to happen to
|
||||
4. to be on duty" zhí 值 值
|
||||
1. (coll.) if yào shi 要是 要是
|
||||
1. perhaps; maybe yě xǔ 也许 也許
|
||||
"1. (after a verb) indicating the beginning and continuation of an action or a state
|
||||
2. indicating an upward movement (e.g. after 站[zhan4])
|
||||
3. indicating completion
|
||||
4. (after a perception verb, e.g. 看[kan4]) expressing preliminary judgment
|
||||
5. also pr. [qi3lai5]" qi lai 起来 起來
|
||||
"1. this kind of
|
||||
2. so
|
||||
3. this way
|
||||
4. like this
|
||||
5. such" zhè yàng 这样 這樣
|
||||
1. immediately; at once; right away lì kè 立刻 立刻
|
||||
"1. really
|
||||
2. sure enough
|
||||
3. as expected
|
||||
4. if indeed" guǒ rán 果然 果然
|
||||
"1. to worry; to feel anxious
|
||||
2. to feel a sense of urgency; to be in a hurry
|
||||
3. Taiwan pr. [zhao1ji2]" zháo jí 着急 著急
|
||||
"1. taken in (by sb's deceit)
|
||||
2. to be fooled
|
||||
3. to be duped" shàng dàng 上当 上當
|
||||
"1. visa
|
||||
2. to issue a visa" qiān zhèng 签证 簽證
|
||||
"1. time difference
|
||||
2. time lag
|
||||
3. jet lag" shí chā 时差 時差
|
||||
"1. cause
|
||||
2. origin
|
||||
3. root cause
|
||||
4. reason
|
||||
5. CL:個|个[ge4]" yuán yīn 原因 原因
|
||||
"1. many
|
||||
2. a lot of
|
||||
3. much" xǔ duō 许多 許多
|
||||
1. food shí wù 食物 食物
|
||||
1. fluent liú lì 流利 流利
|
||||
1. to forget wàng jì 忘记 忘記
|
||||
"1. muddled
|
||||
2. silly
|
||||
3. confused" hú tu 糊涂 糊塗
|
||||
1. gradually jiàn jiàn 渐渐 漸漸
|
||||
"1. assistance; aid
|
||||
2. to help; to assist" bāng zhù 帮助 幫助
|
||||
"1. to feel with the hand
|
||||
2. to touch
|
||||
3. to stroke
|
||||
4. to grope
|
||||
5. to steal
|
||||
6. to abstract" mō 摸 摸
|
||||
"1. at last
|
||||
2. in the end
|
||||
3. finally
|
||||
4. eventually" zhōng yú 终于 終於
|
||||
"1. afterwards; later
|
||||
2. newly arrived" hòu lái 后来 後來
|
||||
"1. to lose the way
|
||||
2. lost
|
||||
3. labyrinth
|
||||
4. labyrinthus vestibularis (of the inner ear)" mí lù 迷路 迷路
|
||||
"1. not long (after)
|
||||
2. before too long
|
||||
3. soon
|
||||
4. soon after" bù jiǔ 不久 不久
|
||||
"1. to shift to an earlier date
|
||||
2. to do sth ahead of time
|
||||
3. in advance" tí qián 提前 提前
|
||||
"1. plan
|
||||
2. project
|
||||
3. program
|
||||
4. to plan
|
||||
5. to map out
|
||||
6. CL:個|个[ge4],項|项[xiang4]" jì huà 计划 計劃
|
||||
"1. frequently; constantly; regularly; often
|
||||
2. day-to-day; everyday; daily" jīng cháng 经常 經常
|
||||
1. to happen; to occur; to take place; to break out fā shēng 发生 發生
|
||||
1. any; whatever; whichever rèn hé 任何 任何
|
||||
"1. (physics) mass
|
||||
2. quality (i.e. degree of excellence)
|
||||
3. quality and quantity" zhì liàng 质量 質量
|
||||
|
@@ -1,101 +0,0 @@
|
||||
事情
|
||||
复杂
|
||||
如果
|
||||
尝
|
||||
味道
|
||||
必须
|
||||
虽然
|
||||
所有
|
||||
满意
|
||||
别人
|
||||
只好
|
||||
拿手
|
||||
的话
|
||||
刚才
|
||||
正在
|
||||
请客
|
||||
节日
|
||||
传统
|
||||
放假
|
||||
一般
|
||||
最后
|
||||
祝贺
|
||||
而且
|
||||
年轻
|
||||
打算
|
||||
一块儿
|
||||
留
|
||||
收拾
|
||||
结婚
|
||||
水平
|
||||
通过
|
||||
开玩笑
|
||||
离开
|
||||
机会
|
||||
继续
|
||||
提高
|
||||
学期
|
||||
感谢
|
||||
将来
|
||||
好几
|
||||
谈
|
||||
恋爱
|
||||
成功
|
||||
却
|
||||
确实
|
||||
效果
|
||||
经验
|
||||
挺
|
||||
至少
|
||||
条件
|
||||
印象
|
||||
愿意
|
||||
原来
|
||||
能力
|
||||
赚
|
||||
得
|
||||
提醒
|
||||
相信
|
||||
骗
|
||||
平均
|
||||
普通
|
||||
相通
|
||||
总是
|
||||
平时
|
||||
突然
|
||||
急忙
|
||||
捡
|
||||
指
|
||||
仔细
|
||||
值
|
||||
丟
|
||||
要是
|
||||
也许
|
||||
起来
|
||||
这样
|
||||
于是米
|
||||
立刻
|
||||
果然
|
||||
着急
|
||||
上当
|
||||
签证
|
||||
时差
|
||||
原因
|
||||
许多
|
||||
食物
|
||||
流利
|
||||
忘记
|
||||
糊涂
|
||||
渐渐
|
||||
帮助
|
||||
摸
|
||||
终于
|
||||
后来
|
||||
迷路
|
||||
不久
|
||||
提前
|
||||
计划
|
||||
经常
|
||||
发生
|
||||
任何
|
||||
质量
|
||||
46
data/口语2.tsv
46
data/口语2.tsv
@@ -1,46 +0,0 @@
|
||||
"1. to pay a sum of money
|
||||
2. payment" fù kuǎn 付款 付款
|
||||
"1. to tie
|
||||
2. bind or fasten together
|
||||
3. to kidnap" bǎng 绑 綁
|
||||
1. interjection indicating approval, appreciation or agreement en 嗯 嗯
|
||||
"1. information
|
||||
2. news
|
||||
3. message" xìn xī 信息 信息
|
||||
"1. careful; attentive; cautious
|
||||
2. to be careful; to look out
|
||||
3. (dialect) thrifty; frugal" zǐ xì 仔细 仔細
|
||||
1. to pay (money) zhī fù 支付 支付
|
||||
"1. to catch and hold on
|
||||
2. to continue
|
||||
3. to go on to do sth
|
||||
4. to follow
|
||||
5. to carry on
|
||||
6. then
|
||||
7. after that
|
||||
8. subsequently
|
||||
9. to proceed
|
||||
10. to ensue
|
||||
11. in turn
|
||||
12. in one's turn" jiē zhe 接着 接著
|
||||
"1. angle
|
||||
2. corner
|
||||
3. horn
|
||||
4. horn-shaped
|
||||
5. unit of money equal to 0.1 yuan, or 10 cents (a dime)
|
||||
6. CL:個|个[ge4]" jiǎo 角 角
|
||||
"1. way; method; manner; mode; pattern (of behavior etc)
|
||||
2. CL:種|种[zhong3]" fāng shì 方式 方式
|
||||
"1. 2D barcode; matrix code
|
||||
2. (esp.) QR code" èr wéi mǎ 二维码 二維碼
|
||||
"1. just in case
|
||||
2. if by any chance
|
||||
3. contingency" wàn yī 万一 萬一
|
||||
1. cash xiàn jīn 现金 現金
|
||||
"1. additional
|
||||
2. in addition
|
||||
3. besides
|
||||
4. separate
|
||||
5. other
|
||||
6. moreover
|
||||
7. furthermore" lìng wài 另外 另外
|
||||
|
13
data/口语2.txt
13
data/口语2.txt
@@ -1,13 +0,0 @@
|
||||
付款
|
||||
绑
|
||||
嗯
|
||||
信息
|
||||
仔细
|
||||
支付
|
||||
接着
|
||||
角
|
||||
方式
|
||||
二维码
|
||||
万一
|
||||
现金
|
||||
另外
|
||||
Reference in New Issue
Block a user