FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit c6c4c924 authored by Silas S. Brown's avatar Silas S. Brown
Browse files

Update charlearn/characters.txt, charlearn/charlearn.py, charlearn/jp/characters.txt

parent 454a530f
No related branches found
No related tags found
No related merge requests found
charset: gb2312
的 [de5] /(possessive particle)/of/
一 [yi1] /a(n)/one/single/
了 [le5] /(modal partical intenstifying preceding clause)/(past tense marker)/
是 [shi4] /am/are/is/to be/yes/
我 [wo3] /I/me/myself/
不 [bu4] /(negative prefix)/no/not/
在 [zai4] /(located) at/exist/in/
人 [ren2] /man/people/person/
们 [men5] /(plural marker for pronouns and a few animate nouns)/
有 [you3] /have/have; possess/there are/there is/to be/to exist/to have/
来 [lai2] /*/[surname]/approx.; over (numbers)/arrive/come/ever since/future/take place/to come/
他 [ta1] /he/him/
这 [zhe4] /these/this/
上 [shang4] /above/first (of two parts)/higher/on/on top/previous/previous or last (week, etc.)/to climb/to go into/to go up/upon/upper/
着 [zhe5] /-ing (indicates an action in progress)/part. indicates accompanying action/
个 [ge4] /(a measure word)/individual/
地 [di4] /background/distance/earth/field/ground/ground; floor/land/land; soil/place/place; locality/position; situation/the earth/
到 [dao4] /to (a place)/to arrive/to go/until (a time)/up to/
大 [da4] /big/deep/eldest/great/huge/large/major/oldest/wide/
里 [li3] /2 kilometer/Chinese mile/[surname]/furlong/in/inside/li, a Chinese unit of length = 1/miles/neighborhood/village/within/
说 [shuo1] /to say/to speak/
去 [qu4] /to go/to leave/to remove/
子 [zi3] /"son/11 p.m.-1 a.m./1st earthly branch/[surname]"/child/egg/midnight/person/seed/seed; egg/small thing/son/sth. small & hard/young (animal, veg.)/\n[zi5] /(noun suff.)/
得 [de2] /allow/contented/finished/gain/get/obtain/permit/proper/proud/ready/suitable/\n[de5] /a sentence particle used after a verb to show effect/degree or possiblility/
也 [ye3] /also/too/
和 [he2] /and/harmony/peace/together with/union/with/\n[he4] /cap (a poem)/respond in singing/
那 [na3] /how/which/\n[na4] /that/those/
要 [yao1] /ask/coerce/demand/request/\n[yao4] /important/must/to be going to/to want/vital/
下 [xia4] /below/down(wards)/latter/lower/next (week, etc.)/second (of two parts)/to decline/to go down/under/underneath/
看 [kan1] /to guard/to look after/to take care of/to watch/\n[kan4] /it depends/look/see/think/to look at/to see/watch/
天 [tian1] /day/heaven/sky/
时 [shi2] /O'clock/hour/period/season/time/when/
过 [guo4] /(past tense marker)/(surname)/to cross/to get along/to go over/to live/to pass (time)/
出 [chu1] /(a measure word for dramas, plays, or operas)/to come out/to go beyond/to go out/to happen/to occur/to produce/to put forth/to rise/
小 [xiao3] /few/small/tiny/young/
么 [me5] /(interrog. suff.)/
起 [qi3] /to get up/to raise/to rise/
你 [ni3] /you/
都 [dou1] /all/all (referring to causes)/all; also/all; both/already/both (if two things are involved)/entirely (due to)each/even/
把 [ba3] /(a measure word)/(marker for direct-object)/handle/to contain/to grasp/to hold/to take hold of/
好 [hao3] /fine/good/good(fine)/well/\n[hao4] /be fond of/
还 [hai2] /(not) yet/also/else/in addition/more/still/yet/
多 [duo1] /a lot of/many/much/multi-/numerous/
没 [mei2] /(negative prefix for verbs)/have not/not/
为 [wei2] /act as/take...to be/to be/to become/to do/to serve as/\n[wei4] /because of/for/to/
又 [you4] /(once) again/again/also/both... and.../
可 [ke3] /(particle used for emphasis)/able to/can/certain(ly)/may/to suit/
家 [jia1] /* (addressing senior)/* (profession)/-er/-ian/-ist/MW (families; enterprises)/[surname]/a person engaged in a certain art or profession/domestic; tamed/family/furniture/home/household; family/school of thought/tool/
学 [xue2] /-ology/branch of learning/imitate/knowledge/learn/learning/school/science/study/subject of study/
只 [zhi1] /(a measure word, for birds and some animals, etc.)/M for one of a pair/only/single/\n[zhi3] /but/just/merely/only/
以 [yi3] /according to/because/by/in order to/so as to/to use/with/
主 [zhu3] /Lord/[surname]/advocate/be in charge of/freedom from doubt/host/lord/main/master/primary/to host/to own/
会 [hui4] /association/be able to/be possible/can/group/to assemble/to gather/to meet/to see/union/
样 [yang4] /appearance/manner/pattern/shape/way/
年 [nian2] /[surname]/year/
想 [xiang3] /intend/think/to believe/to miss/to suppose/to think/to want/to wish/want to/
能 [neng2] /able/can/capable/energy/may/
生 [sheng1] /"birth, give"/[surname]/extremely/get/give birth to/grow/life/light (a fire)/livelihood/living/raw/stiff/student/to be born/to give birth/to grow/unfamiliar/unripe/
同 [tong2] /alike/like/same/similar/together/with/
老 [lao3] /(a prefix used before the surname of a person or a numeral indicating the order of birth of the children in a family to indicate affection or familiarity)/old (of people)/
中 [zhong1] /China/Chinese/among/center/during/in/middle/while (doing sth)/within/\n[zhong4] /hit (the mark)/
从 [cong1] /lax/unhurried/yielding/\n[cong2] /follow/from/obey/observe/
自 [zi4] /from/oneself/self/since/
面 [mian4] /"face/*/MW: flat & smooth"/aspect/face/fade/flour/noodles/personally/powder/scale, range/side/side, aspect/surface/surface, top/top/wheat flour/\n[mian3] /inundation/name of a river/
前 [qian2] /ago/before/earlier/former/front/in front/previous/
头 [tou2] /MW (bulb of garlic)/MW (domestic animals)/beginning or end/chief; head/first/hair style/head/leading/remnant/side; aspect/top; end/\n[tou5] /suff. for nouns/
到 [dao4] /to (a place)/to arrive/to go/until (a time)/up to/
它 [ta1] /it/
后 [hou4] /queen/
然 [ran2] /-ly/correct/like this/right/so/thus/
走 [zou3] /to go/to move/to walk/
很 [hen3] /extremely/very/
像 [xiang4] /(look) like/appearance/elephant/image/like/like; similar/look/picture/portrait/resemble/seem/similar (to)/to appear/to look/to seem/
见 [jian4] /to appear (to be sth)/to interview/to meet/to see/
两 [liang3] /a few/both/ounce/some/tael/two/
用 [yong4] /to use/use/
她 [ta1] /she/
国 [guo2] /country/nation/state/
动 [dong4] /to act/to change/to move/to use/
进 [jin4] /advance/enter/to come in/
成 [cheng2] /accomplish/become/complete/finish/one tenth/succeed/turn into/win/
回 [hui2] /(a measure word for matters or actions) a time/to answer/to circle/to go back/to return/to revolve/to turn around/
什 [shi2] /tenth/
边 [bian1] /border/boundary/edge/margin/side/
作 [zuo4] /to do/to make/to regard as/to take (somebody) for/
对 [dui4] /correct (answer)/couple/for/pair/right/to/to answer/to be opposite/to direct (towards sth)/to face/to oppose/to reply/
开 [kai1] /open/operate (vehicle)/start/
而 [er2] /(shows causal relation)/(shows change of state)/(shows contrast)/and/as well as/but (not)/yet (not)/
已 [yi3] /afterwards/already/then/to stop/
些 [xie1] /(a measure word)/few/several/some/
现 [xian4] /appear/current/existing/now/present/
山 [shan1] /"mount, mountain"/[surname]/hill/mountain/
民 [min2] /citizen/nationality/the people/
候 [hou4] /wait/
经 [jing1] /classics/pass through/sacred book/scripture/to undergo/
发 [fa1] /to develop/to issue/to send out/to show (one's feeling)/\n[fa4] /hair/
工 [gong1] /craft/labor/profession/skill/trade/work/worker/works/
向 [xiang4] /direction/guide/opposite to/part/side/to/towards/
事 [shi4] /affair/item/matter/thing/work/
命 [ming4] /fate/life/
给 [gei3] /(passive particle)/for/for the benefit of/to/to allow/to do sth (for sb)/to give/
长 [chang2] /always/constantly/forever/length/long/strong point; forte/
水 [shui3] /[surname]/river/water/
几 [ji1] /almost/small table/\n[ji3] /a few/how many/how much/several/
义 [yi4] /[surname]/justice/meaning/righteous(-ness)/\n[yi2] /to leave behind/to lose/
三 [san1] /three/
声 [sheng1] /(a measure word, used for sounds)/noise/sound/tone/voice/
于 [yu2] /(surname)/at/in/\n[yu4] /better/heal/to recover/
高 [gao1] /[surname]/height/high/superior/tall/
正 [zheng1] /Chinese 1st month of year/\n[zheng4] /correct/just (right)/main/principle/straight/upright/
妈 [ma1] /ma/mamma/
手 [shou3] /convienent/hand/
知 [zhi1] /to be aware/to know/
理 [li3] /inner principle or structure/logic/reason/science/
眼 [yan3] /eye/
志 [zhi4] /mark/sign/the will/to record/write a footnote/
点 [dian3] /(a measure word)/(decimal) point)/(downwards-right convex character stroke)/MW:\n[used to indicate time]/MW: a little; some/aspect; feature/check; check to see that the number is correct/dot/dot; spot; speck/drip/drop/hint; point out/hour/light; kindle/o'clock/point/put a dot/select; choose/touch on briefly/
心 [xin1] /heart/mind/
战 [zhan4] /battle/fight/to fight/war/
二 [er4] /two/
问 [wen4] /to ask/
但 [dan4] /[surname]/but/but; yet; nevertheless/however/merely/only/still/yet/
身 [shen1] /(a measure word used for clothes) suit/body/life/person/pregnancy/status/torso/
方 [fang1] /direction/just/quadrilateral/square/
实 [shi2] /honest/real/really/solid/true/
吃 [chi1] /absorb; soak up/destroy/eat/eat at/eat; take/eradicate/exhaust; be a strain/feed(to eat)/live on/receive/suffer; incur/wipe out/
做 [zuo4] /to do/to make/to produce/
叫 [jiao4] /to (be) call(ed)/
当 [dang1] /during/equal/just at/just at (a time or place)/manage/match equally/obstruct/on the spot/ought/right/same/should/to act as/to be/when/withstand/\n[dang4] /adequate/at or in the very same.../fitting/proper/replace/represent/suitable/to pawn/
住 [zhu4] /"reside/* (indicating a halt, standstill etc.)"/cease/live; dwell/to dwell/to live/to reside/to stop/
听 [ting1] /administer/allow; let/hear/heed; obey/listen/listen; hear/obey/tin; can/\n[ting4] /allow/let/
革 [ge2] /leather/remove/
打 [da2] /dozen/\n[da3] /[indic. certain body movements]/adopt; use/beat/beat up/break/break; smash/build/buy/calculate/catch; hunt/collect; reap/construct/dig/dispatch/draw/engage in/estimate/fetch/fight/fight; attack/forge/from/from; since/get rid of/issue/knit; weave/make/mix up/play/raise/shoot/since/slap/spray; spread/strike/strike; hit/tie up/work out/
呢 [ne5] /(question particle)/
真 [zhen1] /[surname]/clearly/genuine/genuine(-ly)/real/real(-ly)/true/true(-ly)/unmistakably/
党 [dang3] /[surname]/association/club/gang; clique; faction/party/political party/society/
全 [quan2] /[surname]/all/complete/entire/entire or whole/entirely/every/intact; perfect/whole/
才 [cai2] /[for emphasis]/[indicates condition stated in subordinate clause is a prerequisite]/[indicates that sth. has just happened or is rather late by general standards]/[number is small] only/[surname]/ability/ability; talent; gift/an expert/endowment/gift/just/not until/only (then)/only if/people of a certain type/talent/then; afterwards/
四 [si4] /four/
已 [yi3] /afterwards/already/then/to stop/
所 [suo3] /actually/place/
敌 [di2] /enemy/match/
之 [zhi1] /(literary equivalent of 的)/(subor. part.)/her/him/it/
最 [zui4] /(the) most/-est/
光 [guang1] /[surname]/bare/bright/glory/light/light; illumination/luminary(light)/only/ray/scenery/smooth/used up/
产 [chan3] /estate/give birth/produce/products/property/resources/to produce/to reproduce/
情 [qing2] /emotion/feeling/passion/situation/
路 [lu4] /(surname)/[surname]/path/road/way/
分 [fen1] /(a measure word)/(a unit of length = 0.33 centimeter)/MW/distribute/divide/minute/part/to divide/\n[fen4] /part/
总 [zong3] /always/chief/gather/general/head/in every case/overall/to assemble/total/
条 [tiao2] /(measure word for ribbon)/a strip/article/etc./item/river/
白 [bai2] /(made) clear/White (as a symbol of reaction)/[surname]/blank/bright/clear/empty/free of charge/gratuitous/in vain; to no effect/mispronounced/plain/pure/pure; plain; blank/snow-white/snowy/spoken part in opera/state; explain/white/wrongly written/
话 [hua4] /conversation/dialect/language/speech/spoken words/talk/utterance/what someone said/word/words/
东 [dong1] /east/
席 [xi2] /banquet/place/seat/woven mat/
次 [ci4] /(measure word)/next/nth/number (of times)/order/second(ary)/sequence/
亲 [qin1] /closely related/dear/intimate/parent/relation/
如 [ru2] /as (if)/such as/
被 [bei4] /blanket/by (marker for passive-voice sentences or clauses)/quilt/to cover/to wear/
花 [hua1] /blossom/fancy pattern/flower/to spend (money, time)/
口 [kou3] /(a measure word)/Great Wall gateway/MW/age of draft animal/hole; cut/knife edge/mouth/opening; entrance/
放 [fang4] /to free/to let go/to let out/to place/to put/to release/
儿 [er2] /son/\n[er5] /non-syllabic dimi. suff./
常 [chang2] /[surname]/always/common/constant/ever/frequently/frequently; often/general/invariable/often/often; frequent/ordinary; common; normal/
西 [xi1] /west/
气 [qi4] /air/anger/gas/smell/to be enraged/to get angry/to make sb. angry/vital breath/weather/
五 [wu3] /5/five/
第 [di4] /(prefix before a number, for ordering numbers, eg, "first", "number two", etc)/
使 [shi3] /cause/make(let)/messenger/to cause/to employ/to enable/to make/to use/
写 [xie3] /to write/write/
军 [jun1] /arms/army/military/
吧 [ba1] /(onomat.)/dumb/\n[ba5] /(modal particle indicating polite suggestion)/...OK?/...right?/
文 [wen2] /culture/formal/language/literary/writing/
运 [yun4] /fate/fortune/luck/to move/to transport/to user/
在 [zai4] /(located) at/exist/in/
果 [guo3] /fruit/result/
怎 [zen3] /how/
定 [ding4] /to decide/to determine/to fix/to order/to set/
许 [xu3] /(surname)/to allow/to permit/to praise/
快 [kuai4] /fast/quick/swift/
明 [ming2] /bright/clear/next/to understand/
行 [xing2] /OK/all right/capable/competent/okay/temporary/to do/to go/to travel/to walk/will do/\n[xing4] /behavior/conduct/
因 [yin1] /because/cause/reason/
别 [bie2] /another/classify/depart/distinguish/do not/leave/must not/other/seperate/to pin/\n[bie4] /awkward/contrary/difficult/
飞 [fei1] /flutter/fly/hover/swiftly/to fly/
外 [wai4] /external/foreign/in addition/outside/
树 [shu4] /[surname]/tree/
物 [wu4] /matter/object/thing/
活 [huo2] /alive/living/to live/work/workmanship/
部 [bu4] /(a measure word for works of literature, films, machines, etc.)/(a measure word)/board/department/division/ministry/part/section/troops/
门 [men2] /MW/[surname]/door/entrance/family/field of endeavor/gate/gate(door)/knack/school (of thought)/sect/valve; switch/
无 [wu2] /-less/no/none/not/not to have/to lack/un-/
往 [wang3] /past/previous/to go (in a direction)/towards/\n[wang4] /(of a train) bound for/toward/
船 [chuan2] /a boat/boat/boat; ship/ship/vessel/
望 [wang4] /expect/hope/look towards/to gaze (into the distance)/to visit/towards/
新 [xin1] /[surname]/meso- (chem.)/new/newly/
带 [dai4] /[suggesting doing sth. at an opportune moment]/and/area/band/bear; have; with/belt/belt; girdle; ribbon; band; tape/bring/carry/consists of/girdle/lead/lead; head/look after; bring up; raise/region/ribbon/show/take; bring; carry/tyre/wear/zone/
队 [dui4] /group/squadron/team/
先 [xian1] /early/first/former/in advance/prior/
力 [li4] /force/power/strength/
完 [wan2] /complete/entire/to be over/to finish/whole/
间 [jian1] /(measure word)/among/between/space/\n[jian4] /interstice/separate/
却 [que4] /but/however/nevertheless/to decline/to go back/to retreat/while/yet/yet; but/
站 [zhan4] /stand/station/stop/to halt/to stand/to stop/
代 [dai4] /[surname]/age/dynasty/era/generation/geological era/historical period/period/replace/substitute/take the place of; act for (or on behalf of) others/
员 [yuan2] /employee/member/person/
机 [ji1] /machine/opportunity/secret/
更 [geng1] /to change/\n[geng4] /even more/further/more/still/still more/
九 [jiu3] /9/nine/
您 [nin2] /you (formal)/you (polite & respect form)/
每 [mei3] /each/every/
风 [feng1] /[surname]/custom/draft/manner/news/news; information/scene; view/style/style; practice; custome/wind/
级 [ji2] /grade/level/rank/step/
跟 [gen1] /and/heel/to follow/to go with/with/
笑 [xiao4] /laugh/smile/
啊 [a1] /(interj.)/ah/\n[a2] /an interjection/to express doubt or to question/to show realization/to stress/\n[a3] /(interj. for surprise)/\n[a4] /oh (interjection)/\n[a5] /(a modal particle showing affirmation, approval, or consent)/
孩 [hai2] /child/
万 [wan4] /(surname)/10,000/a great number/ten thousand/
少 [shao3] /few/lack/little/\n[shao4] /young/
直 [zhi2] /directly/frank/straight/straightly/upright/vertical/
意 [yi4] /desire/idea/meaning/wish/\n[yi1] /clothes/\n[yi4] /gown/to dress/to wear/
夜 [ye4] /night/
比 [bi3] /(particle used for comparison and "-er than")/ratio/to compare/to contrast/to gesture (with hands)/\n[bi4] /associate with/be near/
阶 [jie1] /rank or step/stairs/
连 [lian2] /(surname)/as/even/join/successively/to link/
车 [che1] /a vehicle/car/machine/to shape with a lathe/
重 [zhong4] /heavy/serious/
便 [bian4] /convenient/easy/handy/ordinary/plain/so/then/thus/to relieve oneself/
斗 [dou3] /Chinese peck/\n[dou4] /fight/incite/to battle/to fight/to incite/to struggle/
马 [ma3] /21st of month (tele.)/Ma (a surname)/[surname]/horse/
哪 [na3] /how/which/\n[na5] /(final part. preceded by N)/
化 [hua4] /-ization/to ... -ize/to change into/to make into/to transform/
太 [tai4] /extremely/greatest/highest/too (much)/very/
指 [zhi3] /finger/to direct/to indicate/to point/
变 [bian4] /rebellion/to become different/to change/to transform/to vary/
社 [she4] /group/society/
似 [si4] /like/similar/to appear/to resemble/to seem/
士 [shi4] /knight/scholar/warrior/
者 [zhe3] /-ist, -er (person)/person (who does sth)/
干 [gan1] /dry/shield/to concern/\n[gan4] /manage/stem/to do/to manage/to work/
石 [shi2] /rock/stone/
满 [man3] /Manchurian/filled/packed/to fulfill/to full/
决 [jue2] /breach (a dyke)/to decide/to determine/
百 [bai3] /hundred/
原 [yuan2] /cause/former/level/original/primary/raw/source/
拿 [na2] /to apprehend/to catch/to hold/to seize/to take/
群 [qun2] /MW/crowd/flock/group/
究 [jiu1] /after all/to investigate/to study carefully/
各 [ge4] /each/every/
六 [liu4] /six/
本 [ben3] /(a measure word)/basis/foundation/origin/root/roots or stems of plants/source/the current/this/
思 [si1] /to consider/to think/
解 [jie3] /to break up/to divide/to emancipate/to explain/to loosen/to separate/to untie/\n[jie4] /transport under guard/
立 [li4] /set up/to stand/
河 [he2] /river/
爸 [ba4] /dad/father/pa/papa/
村 [cun1] /village/
八 [ba1] /8/eight/
难 [nan2] /difficult/difficult (to...)/difficulty/not good/problem/\n[nan4] /disaster/distress/to scold/
早 [zao3] /early/morning/
论 [lun4] /by the/discuss/per/theory/to discuss/to talk (about)/
吗 [ma3] /morphine/\n[ma5] /(question tag)/
根 [gen1] /MW (long & thin objects)/basis/cause; origin/radical (chem.)/root/root; foot; base/source; root/
共 [gong4] /all together/common/general/in while/to share/together/
让 [rang4] /have (someone do something)/permit/to allow/to ask/to let/to yield/
相 [xiang1] /each other/mutually/one another/\n[xiang4] /appearance/picture/portrait/
研 [yan2] /grind fine/research/study/
今 [jin1] /current/modern/now/present/this/today/
其 [qi2] /her/his/it (refers to sth preceding it)/its/such/that/theirs/
书 [shu1] /book/letter/
坐 [zuo4] /to sit/to take (a bus, aeroplane etc.)/to take a seat/
接 [jie1] /to connect/to extend/to join/to receive/
应 [ying1] /ought/\n[ying4] /(surname)/to answer/to respond/
关 [guan1] /"shut/(surname)/[surname]"/barrier/close down/customs house/involve/lock up/mountain pass/pass, check/shut; close/to close/to concern/to involve/to shut/to turn off/turn off/
信 [xin4] /[surname]/believe/evidence/letter/message/sign/to believe/true/trust/
觉 [jue2] /awake/aware/feel/find that/thinking/
死 [si3] /inflexible/inpassable/rigid/to die/uncrossable/
步 [bu4] /a pace/a step/march/stages in a process/walk/
反 [fan3] /anti-/wrong side out or up/
处 [chu3] /deal with/get along with/to be in/to be in a position of/to dwell/to live/to reside/to stay/\n[chu4] /a place/bureau/department/location/office/point/respect/spot/
记 [ji4] /mark/sign/to note/to record/to remember/
将 [jiang1] /(will, shall, "future tense")/prepared/ready/to get/to use/\n[jiang4] /a general/
千 [qian1] /a swing/thousand/
找 [zhao3] /find; finding; found/give sb change/search/seek/to call on (sb)/to find/to look for/to return/to seek/to try to find/
争 [zheng1] /fight/struggle/
领 [ling3] /collar/neck/to lead/to receive/
或 [huo4] /maybe/might/or/perhaps/possibly/
师 [shi1] /a division (milit.)/expert/master/model/teacher/
结 [jie1] /bond/knot/sturdy/to bear (fruit)/to bind/to tie/
块 [kuai1] /(measure word for chunks, lumps)/chunk/lump/piece/\n[kuai4] /(a measure word, for cloth, cake, soap)/fast (of a watch)/happy/joyful/quick/rapid/soon/swift/yuan (unit of currency)/
跑 [pao3] /run/to escape/to run/
谁 [shui2] /who/
草 [cao3] /careless/careless; rough; hasty/draft/draft (of a document)/grass/grass; straw/hasty/manuscript/rough/straw/
越 [yue4] /the more ... the more/to climb over/to exceed/to surpass/
字 [zi4] /character/letter/symbol/word/
加 [jia1] /plus/to add/
脚 [jiao3] /a kick/base (of hill etc)/foot/role/
紧 [jin3] /nervous/strict/tight/
爱 [ai4] /affection/affection; love/be apt to/be in the habit of/like/like; be fond of/love/to be fond of/to like/to love/
等 [deng3] /and so on/await/class/equal to/et cetera/grade/rank/same as/wait for/
习 [xi2] /habit/to practice/to study/
阵 [zhen4] /burst/disposition of troops/short period/spate/spell/wave/
怕 [pa4] /to be afraid/to fear/
月 [yue4] /month/moon/
青 [qing1] /9th of month (tele.)/blue-green/
半 [ban4] /(after a number) and a half/half/incomplete/semi-/
火 [huo3] /[surname]/fire/
法 [fa3] /Legalist/law/method/way/
题 [ti2] /subject/to inscribe/to superscribe/topic/
建 [jian4] /to build/to construct/to establish/to found/to set up/
赶 [gan3] /catch up/drive away/hurry/to catch up/to drive away/to hurry/to overtake/to rush/
位 [wei4] /(measure word for persons)/location/place/position/seat/
唱 [chang4] /[surname]/call; cry/sing/to call loudly/to chant/
海 [hai3] /[surname]/ocean/sea/
七 [qi1] /7/seven/
女 [nu:3] /female/woman/
任 [ren4] /office/responsibility/to appoint/to assign/
件 [jian4] /(a measure word for thing/clothes/item/
感 [gan3] /to affect/to feel/to move/to touch/
准 [zhun3] /accurate/standard/to allow/to grant/to permit/
张 [zhang1] /(a measure word)/(a surname)/open up/
团 [tuan2] /circular/dumpling/group/regiment/round/society/
屋 [wu1] /house/room/
爷 [ye2] /etc./grandpa/old gentleman/
离 [li2] /(distant) from/from/to depart/to go away/to leave/
色 [se4] /appearance/color/look/
脸 [lian3] /cheek/countenance/face/
片 [pian1] /disc/sheet/\n[pian4] /a slice/flake/flate/piece/slice/thin/
科 [ke1] /branch/branch of medicine/division/family/field/subject/
倒 [dao3] /bankrupt/change; exchange/collapse; be overthrown; close down/fall(toppled)/fall; topple/to change/to collapse/to fail/to fall/to topple/\n[dao4] /inverted/to go home/to pour/to the contrary/to tip/turn over/upset/
睛 [jing1] /eye/
利 [li4] /advantage/benefit/profit/sharp/
世 [shi4] /age/era/generation/life/lifetime/world/
病 [bing4] /ailment/defect/disease/fall ill/illness/sick/sickness/
刚 [gang1] /barely/exactly/firm/hard/just/strong/
且 [qie3] /further/moreover/
由 [you2] /because of/by/cause/due to/follow/from/it is for...to/reason/to/to leave it (to sb)/
送 [song4] /"deliver/carry/escort"/give as a present/see sb. off, our/send(to deliver)/to carry/to deliver/to give (as a present)/to present (with)/to see off/to send/
切 [qie1] /to cut/to slice/\n[qie4] /close to/
星 [xing1] /satellite/small amount/star/
晚 [wan3] /evening/late/night/
表 [biao3] /a list or table/a meter/a watch/an example/chart/express/exterior/external/surface/to show/to watch/
够 [gou4] /to be enough/to reach/
整 [zheng3] /complete/entire/exactly/in good order/in order/orderly/whole/
认 [ren4] /to admit/to know/to recognize/
响 [xiang3] /(a measure word for sound)/loud/to make a sound/to ring/to sound/
雪 [xue3] /(avenge a wrong)/[surname]/snow/wipe out (a humiliation)/
流 [liu2] /to circulate/to flow/to move/to spread/
未 [wei4] /1-3 p.m./8th earthly branch/did not/have not/not/not yet/
场 [chang3] /(a measure word, used for sport or recreation)/a courtyard/a measure word/field/open space/place/
该 [gai1] /most likely/ought to/owe/should/that/the above-mentioned/to deserve/
并 [bing4] /(not) at all/also/amalgamate/and/combine/furthermore/simultaneously/to combine/to join/to merge/together with/
底 [di3] /background/base/bottom/
深 [shen1] /deep/deeply/depth/profound/
刻 [ke4] /(a measure word)/carve/cutting/engrave/highest degree/moment/oppressive/quarter (hour)/to carve/to cut/to engrave/?/
平 [ping2] /calm/equal/flat/level/peaceful/to draw/to make the same score/to tie/
伟 [wei3] /big/great/large/
忙 [mang2] /busy/
提 [ti2] /(upwards character stroke)/lifting (brush stroke in painting)/to carry/to lift/to mention/to put forward/
确 [que4] /authenticated/firm/real/solid/true/
近 [jin4] /approximately/close (to)/near/
亮 [liang4] /bright/light/
轻 [qing1] /easy/gentle/hydrogen/light/soft/
讲 [jiang3] /speech/to explain/to speak/to talk/to tell/
农 [nong2] /agriculture/
古 [gu3] /ancient/old/
黑 [hei1] /black/dark/
告 [gao4] /to inform/to say/to tell/
界 [jie4] /boundry/circles (ie, a group of people)/
拉 [la1] /to drag/to draw/to play (string instruments)/to pull/
名 [ming2] /(measure word for persons)/MW (persons)/[surname]/fame/famous/name/place (e.g. among winners)/reputation/well-known/
呀 [ya5] /(final part.)/
土 [tu3] /dust/earth/
清 [qing1] /clear/complete/distinct/pure/
阳 [yang2] /positive (electric.)/sun/
照 [zhao4] /according to/in accordance with/photograph/to illuminate/to reflect/to shine/
办 [ban4] /to deal with/to do/to go about/to handle/to manage/to run/to set up/
史 [shi3] /history/
改 [gai3] /to alter/to change/to correct/to transform/
历 [li4] /all/calendar/each/every/to experience/to pass through/to undergo/
转 [zhuan3] /"corner, turn"/to convey/to forward (mail)/to shift/to transfer/to turn/transfer/turn; change/\n[zhuan4] /to circle about/to revolve/to turn/to walk about/
画 [hua4] /draw/painting/picture/
造 [zao4] /educate/invent/make/make(create)/to build/to invent/to make/to manufacture/
嘴 [zui3] /mouth/
此 [ci3] /these/this/
治 [zhi4] /cure/to control/to govern/to harness (a river)/to heal/to manage/to rule/treatment/
北 [bei3] /be defeated/north/
必 [bi4] /certainly/must/necessarily/will/
服 [fu2] /clothes/dress/garment/submit/take (medicine)/
雨 [yu3] /rain/
穿 [chuan1] /pass through/pearce/penetrate/perforate/to bore through/to dress/to put on/to thread/to wear/
父 [fu4] /father/
内 [nei4] /inner/inside/interior/internal/within/
识 [shi2] /knowledge/to know/
验 [yan4] /to check/to examine/to test/\n[yan1] /how/where/
传 [chuan2] /to circulate/to conduct (electricity)/to infect/to pass on/to spread/to transfer/to transmit/
业 [ye4] /[surname]/already/business/course of study/enterprise/estate; property/industry/occupation/profession/study/trade/
菜 [cai4] /dish (type of food)/vegetables/
爬 [pa2] /climb/crawl/
睡 [shui4] /to sleep/
兴 [xing1] /flourish/it is the fashion to/to become popular/\n[xing4] /interest/
形 [xing2] /form/shape/to appear/to look/
量 [liang2] /to measure/\n[liang4] /amount/capacity/quantity/to estimate/
咱 [zan2] /we (incl.)/
观 [guan1] /to behold/to look at/to observe/to watch/
苦 [ku3] /bitter/cause suffering/doing one's utmost/hardship/intensely/miserable/pain/painful/suffer from/suffering/
体 [ti3] /body/form/style/system/
众 [zhong4] /multitude/
通 [tong1] /go through/know well/open/to communicate/to connect/
冲 [chong1] /dash against/highway/public road/to charge/to collide/to dash (against)/to rinse/to rush/to wash out/to water/\n[chong4] /dynamic/forceful/of great force/powerful/strong/to punch/towards/
合 [he2] /Chinese musical note/fit/to join/
破 [po4] /broken/damaged/to break/to split/worn out/
友 [you3] /friend/
度 [du4] /capacity/degree/standard/
术 [shu4] /method/technique/
饭 [fan4] /cooked rice/cuisine/food/meal/
公 [gong1] /common/honorable (designation)/just/public/
旁 [pang2] /beside/one side/other/self/side/
房 [fang2] /house/
南 [nan2] /[surname]/south/
枪 [qiang1] /firearm/gun/rifle/spear/
读 [du2] /to read/to study/
沙 [sha1] /[surname]/granule/hoarse/powder/raspy/sand/
岁 [sui4] /(a measure word)/year/years old/
线 [xian4] /line/string/thread/wire/
野 [ye3] /boundry/field/limit/open space/plain/rude/wild/
坚 [jian1] /firm/resolute/solid/strong/unyielding/
空 [kong1] /air/empty/in vain/sky/\n[kong4] /emptied/leisure/
收 [shou1] /receive/accept/bring to an end/collect/gather in/harvest/put away/restrain (emotion, action)"/take in/take in; received/to accept/to collect/to receive/
算 [suan4] /regard as/to calculate/to compute/to figure/
至 [zhi4] /arrive/most/to/until/
城 [cheng2] /city/city wall; wall/city walls/town/
劳 [lao2] /toil/
钱 [qian2] /(surname)/MW (unit of weight)/[surname]/coin/money/
特 [te4] /extraordinary/special/unusual/
围 [wei2] /to circle/to surround/
弟 [di4] /younger brother/
胜 [sheng1] /able to bear/peptide/\n[sheng4] /victorious/
教 [jiao1] /teach/\n[jiao4] /religion/teaching/
热 [re4] /feverent/heat/hot/hot (of weather)/to heat up/warm up/
展 [zhan3] /to postpone/to spread out/to unfold/to use/
包 [bao1] /bag/bundle/container/package/packet/to contract (to or for)/to cover/to hold/to hold or embrace/to include/to take charge of/to wrap/wrapper/
歌 [ge1] /sing/song/
类 [lei4] /category/class/kind/like/similar/to resemble/type/
渐 [jian1] /imbue/\n[jian4] /gradual (ly)/
强 [qiang2] /better/force/power/powerful/strength/
数 [shu3] /count/list/number; count/to count/\n[shu4] /figure/number/several/to calculate/to count/
乡 [xiang1] /country/village/
呼 [hu1] /to breath out/to call/to cry/to exahle/to shout/
性 [xing4] /characteristic/nature/sex/sex; sexual/suffix corresponding to -ness or -ity/surname/
音 [yin1] /news/noise/sound/
答 [da1] /agree/to answer/\n[da2] /answer/echo/reply/respond/return/
哥 [ge1] /elder brother/\n[ge3] /(surname)/
际 [ji4] /among/between/border/boundary/edge/interval/while/
旧 [jiu4] /former/old (opposite of new)/
座 [zuo4] /to sit/to take a seat/
章 [zhang1] /(surname)/[surname]/chapter/seal/section/
帮 [bang1] /gang/group/party/to assist/to help/to support/
啦 [la1] /(onomat.)/(phonetic)/\n[la5] /(an auxiliary word performing the grammatical functions of mood)/fusion of le + a/
受 [shou4] /(passive marker)/to bear/to endure/to receive/to stand/
系 [xi4] /be/bind/connect/connection/department/faculty/relation/system/tie up/to tie/
令 [ling4] /command/decree/honorable/make or cause to be/order/
跳 [tiao4] /bounce/hop/jump/leap/move up & down/skip (a grade)/skip (over)/to beat/to bounce/to leap/
非 [fei1] /non-/not-/un-/
何 [he2] /carry/how/what/which/why/
牛 [niu2] /[surname]/bull/cattle/cow/ox/
取 [qu3] /to choose/to fetch/to get/to take/
入 [ru4] /to enter/
岸 [an4] /bank/beach/coast/shore/
敢 [gan3] /dare/
掉 [diao4] /to drop/to fall/
忽 [hu1] /suddenly/
种 [zhong3] /kind/race (of people)/seed/type/\n[zhong4] /to grow/to plant/
装 [zhuang1] /adorn/adornment/clothing/costume/dress/
顶 [ding3] /a measure word (use with "hat")/go against/most/peak/to replace/to substitute/top/
急 [ji2] /hurried/worried/
林 [lin2] /forest/woods/
停 [ting2] /to halt/to stop/
息 [xi1] /breath/interest/news/rest/
句 [ju4] /(a measure word, for sentences or lines of verse)/sentence/
娘 [niang2] /mother/troubled/young lady/
区 [qu1] /area/distinguish/districts/region/
衣 [yi4] /desire/idea/meaning/wish/\n[yi1] /clothes/\n[yi4] /gown/to dress/to wear/
般 [ban1] /class/kind/manner/sort/way/
报 [bao4] /announce; declare/bulletin; report/newspaper/periodical; journal/recompense/reply; respond; requite/report/revenge/telegram; cable/to announce/to inform/
叶 [ye4] /(surname)/leaf/page/
压 [ya1] /approach/keep under control; control/press/press; push down; weigh down/shelve/suppress/to keep under (control)/to press/to push down/\n[ya4] /in the first place/to crush/
母 [mu3] /female/mother/
慢 [man4] /slow/
叔 [shu1] /uncle in direct address/
背 [bei1] /carry on one's back/to be burdened/to carry on the back or shoulder/\n[bei4] /learn by heart/the back of the body/
细 [xi4] /fine/minutely/slender/thin/
#!/usr/bin/env python2
# Character-learning support program
# (C) 2006-2013 Silas S. Brown. Version 0.1471.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
listenAddr='127.0.0.1'
firstPortNo=9876
tableFile = "characters.txt" # for first-time setup
knownFile = "known-chars.txt" # ditto
dumpFile = "charlearn-data" # for saving progress
reviseFile = "revise.txt" # for requesting more revision next time (will be deleted after integration into progress)
import sys,os.path
if sys.argv[-1].startswith("--"): gradint = None # (don't need to speak if we're processing options, see at end)
elif os.path.isfile("gradint.py"): import gradint
else: gradint = None # won't speak characters
import commands,random,cPickle,BaseHTTPServer,os,thread,string,time,socket
if not sys.version_info[0]==2:
sys.stderr.write("Sorry, charlearn cannot run on Python "+repr(sys.version_info[0])+"\nNeeds Python 2.x\n")
sys.exit(1)
def byPriority(a,b): return a.priority-b.priority
priorityIfGotWrong = -10
priorityOfOtherCharWrong = -4
priorityOfGroupWrong = 0
maxShowInGroup = 5 ; priorityBreakGroup = 10
initSessionLen = sessionLen = 2 ; maxSessionLen = 10 ; sampleConst = 1.5
def updateSessionLen():
global sessionLen
sessionLen = min(max(sessionLen,int(thechars.countKnown()[1]+0.95)),maxSessionLen)
# did have /sampleConst after countKnown()[1] but doesn't seem necessary
already_spoken = {}
gradint_busy = 0
def speak_bkg():
gradint.just_synthesize()
global gradint_busy
gradint_busy = 0
class SingleChar:
def __init__(self,hanzi,pinyin):
self.hanzi = hanzi ; self.pinyin = pinyin
self.priority = 0 ; self.similarityGroup = None
self.supposedToKnow = 0
def formatPinyin(self): return self.pinyin.replace("\n","<BR>") # (could make it into actual tone marks also)
def htmlString(self,parent,step=1,left=0):
self.supposedToKnow = 1
r='<html><head><title>hanzi</title><meta http-equiv="Content-Type" content="text/html; charset=%s"></head><body><h1>%s</h1>' % (parent.charset,self.hanzi)
if step==1: r+=self.yesno('Do you know what this is? (%d remaining)' % left,2,0)
else:
r += self.formatPinyin() + "<HR>"
if step<=0:
if self.similarityGroup:
l = []
for c in parent.chars:
if c.similarityGroup == self.similarityGroup and not id(c)==id(self): l.append(c)
l.sort(byPriority)
r+="Not to be confused with:"
for c in l[:maxShowInGroup-1]: r+='<h1>%s</h1>%s' % (c.hanzi,c.formatPinyin())
r += '<hr>'
if parent.thisSession:
r+='<A HREF="/%s">Next character</A>' % str(random.random())
if step==-1:
# got it right - might as well take that link automatically
r=parent.processRequest("/").replace('</body></html>','')
else:
updateSessionLen()
r+='<A HREF="/quit">Quit</A> | <A HREF="/%s">Another %d</A>' % (str(random.random()),sessionLen)
if step==0:
self.priority=priorityIfGotWrong
self.speak(parent.charset)
else:
# knew it
self.priority += 1
if self.priority > 0:
if self.priority < 25000: self.priority *= 2 # give new characters a chance
else: self.priority = 50000 # level off
else: self.priority /= 2 # TRY this for a while - will make chars got-wrong recover more quickly (again to give new chars a chance)
parent.save()
elif step==2:
r+=self.yesno('Did you get it right?',-1,3)
self.speak(parent.charset)
elif step==3:
r+='What did you think it was?<P>'
toOut = [] # (pinyin,hanzi,id,is-in-same-group)
for c in parent.chars:
if c.similarityGroup and c.similarityGroup==self.similarityGroup: sameGrp=True
else: sameGrp=False # need to do it this way because Python sometimes returns 'None' from that expression
if c.supposedToKnow and not id(c)==id(self): toOut.append((c.pinyin,c.hanzi,id(c),sameGrp)) # NOT formatPinyin, because may want to i-search it
toOut.sort()
if len(toOut) > 20: r+="(Hint: On some browsers you can use find-as-you-type)<P>"
for outSameGroup in [True,False]:
oldL=len(r)
for p,hanzi,val,sameGrp in toOut:
if sameGrp==outSameGroup: r+='%s <A HREF="/%d_%d">%s</A><BR>' % (hanzi,id(self),val,p)
if len(r)>oldL and outSameGroup: r += '<HR>' # between chars in same group and others
r+='<A HREF="/%d=0">None of the above</A>' % id(self)
if not parent.thisSession:
global already_spoken ; already_spoken = {} # reset it so "Another N" does speak them
return r + '</body></html>'
def speak(self,charset):
if self.hanzi in already_spoken: return
already_spoken[self.hanzi] = 1 # don't set a self. attribute - it'll get pickled for next session
if gradint:
gradint.justSynthesize = self.hanzi.decode(charset).encode('utf-8')
global gradint_busy
while gradint_busy: time.sleep(0.5)
gradint_busy = 1
thread.start_new_thread(speak_bkg,())
def yesno(self,question,ifyes,ifno): return question+'<P><A ID="y" HREF="/%d=%d">Yes</A><SCRIPT>document.getElementById("y").focus()</SCRIPT> | <A HREF="/%d=%d">No</A>' % (id(self),ifyes,id(self),ifno) # (don't use the js anywhere except yes/no, because 'next character' etc may have too much on the screen and we don't want the focus() to scroll)
the_speaker_process = None
def terminate_server():
# portable signal.alarm(1)
time.sleep(1); os.abort()
class CharDbase:
def __init__(self):
self.counter = 0 ; self.nextPriority = 0
self.similarityGroups = 0
self.chars = [] ; self.thisSession = []
self.readTable() ; self.readKnown() ; self.readRevise()
def debug_printKnown(self):
print "-*- coding: %s -*-" % (self.charset,)
for c in self.chars:
if c.supposedToKnow: print c.priority,c.hanzi
def readTable(self):
addingTo = 0
if self.chars: addingTo = 1
lines=open(tableFile).readlines()
if lines[0].startswith("charset:"):
self.charset = lines[0].split()[-1]
lines = lines[1:]
else: self.charset = "iso-8859-1"
for line in lines: self.addCharFromFreqTable(line,addingTo)
def readKnown(self):
try:
o=open(knownFile)
except IOError: return
for line in o.readlines(): self.makeCharKnown(line.split()[0])
def readRevise(self):
try:
o=open(reviseFile)
except IOError: return
for line in o.readlines(): self.makeCharRevise(line.split()[0])
def makeCharKnown(self,hanzi):
if not hanzi: return # blank lines etc
for c in self.chars:
if c.hanzi==hanzi:
if not c.supposedToKnow:
c.supposedToKnow = 1
c.priority = priorityOfGroupWrong # just to check
return
print "WARNING: character '%s' in %s was not in %s - ignoring" % (repr(hanzi),knownFile,tableFile)
def makeCharRevise(self,hanzi):
if not hanzi: return # blank lines etc
for c in self.chars:
if c.hanzi==hanzi:
c.supposedToKnow = 1
c.priority = priorityIfGotWrong
return
print "WARNING: character '%s' in %s was not in %s - ignoring" % (repr(hanzi),reviseFile,tableFile)
def addCharFromFreqTable(self,line,checkAlreadyThere):
hanzi,pinyin = string.split(line,maxsplit=1)
c=SingleChar(hanzi,pinyin.replace("\\n","\n"))
c.priority = self.nextPriority ; self.nextPriority += 1
if checkAlreadyThere:
for c2 in self.chars:
if c2.hanzi == hanzi: return
self.chars.append(c)
def charIdToChar(self,charId):
char = None
for c in self.chars:
if id(c)==charId:
char = c ; break
assert char ; return char
def processRequest(self,path):
if '=' in path:
charId,step = map(lambda x:int(x),path[1:].split('='))
char = self.charIdToChar(charId)
elif '_' in path: # grouping
char,char2 = map(lambda x:self.charIdToChar(int(x)),path[1:].split('_'))
if not char.similarityGroup and not char2.similarityGroup: # new group:
self.similarityGroups += 1
char.similarityGroup = char2.similarityGroup = self.similarityGroups
elif not char.similarityGroup: char.similarityGroup = char2.similarityGroup
elif not char2.similarityGroup: char2.similarityGroup = char.similarityGroup
elif not char.similarityGroup == char2.similarityGroup: # merge 2 different groups:
for c in self.chars:
if c.similarityGroup == char2.similarityGroup: c.similarityGroup = char.similarityGroup
step = 0 # normal got-wrong for this character
char.priority = priorityIfGotWrong # here also, for the loop below
char2.priority = min(char2.priority,priorityOfOtherCharWrong)
for c in self.chars:
if c.similarityGroup == char.similarityGroup:
if c.priority >= priorityBreakGroup: c.similarityGroup=None
elif c.priority > priorityOfGroupWrong: c.priority = priorityOfGroupWrong
elif path=="/status":
self.chars.sort(byPriority)
cp=self.chars[:] ; r='<html><head><title>Current Status</title><meta http-equiv="Content-Type" content="text/html; charset=%s"></head><body><h2>Current Status</h2>(score/priority number is shown to the left of each item)<br>' % (self.charset,)
while cp:
if not cp[0].supposedToKnow:
del cp[0] ; continue
if cp[0].priority >= priorityBreakGroup: thisGrp=[0]
else: thisGrp=filter(lambda x:x==0 or (cp[x].similarityGroup and cp[x].similarityGroup==cp[0].similarityGroup and cp[x].priority < priorityBreakGroup),range(len(cp)))
if len(thisGrp)>1 and not r.endswith("<hr>"): r+="<hr>"
if len(thisGrp)>1: r+="<em>"+str(len(thisGrp))+" similar items:</em><br>"
for g in thisGrp: r += str(cp[g].priority)+": "+cp[g].hanzi+" "+cp[g].pinyin+"<br>"
if len(thisGrp)>1: r+="<hr>"
thisGrp.reverse()
for toDel in thisGrp: del cp[toDel]
return r+"</body></html>"
else:
if path=="/checkallknown": self.thisSession = filter(lambda x:x.supposedToKnow,self.chars) # TODO: Document this URL
char,step = self.chooseChar(),1
return char.htmlString(self,step,len(self.thisSession))
def chooseChar(self):
if not self.thisSession:
self.chars.sort(byPriority)
if sessionLen==initSessionLen:
self.thisSession = self.chars[:sessionLen] # introduce in order the first time (especially if the second one is just a straight line ("yi1"), as one beginner thought the program had gone wrong when he saw this)
self.thisSession.reverse() # because taken out by pop()
else: self.thisSession = random.sample(self.chars[:int(sessionLen*sampleConst)],sessionLen) # TODO need a better way than that. NB high priority should be VERY likely, but others should have a chance. try as-is for now
return self.thisSession.pop()
def save(self): cPickle.Pickler(open(dumpFile,"w"),-1).dump(self)
def countKnown(self):
charsSeen = sessnLen = charsSecure = newChars = 0
secure=[] ; insecure=[]
self.chars.sort(byPriority)
for c in self.chars:
if c.supposedToKnow:
charsSeen += 1
if c.priority>0: secure.append(c.hanzi)
else: insecure.append(c.hanzi)
else: newChars += 1
if newChars == 2: sessnLen = charsSeen
return charsSeen,sessnLen,secure,insecure
try:
dumped = open(dumpFile)
except IOError: dumped = None
if dumped:
thechars = cPickle.Unpickler(dumped).load()
dumped.close()
thechars.thisSession = []
if os.stat(tableFile).st_mtime > os.stat(dumpFile).st_mtime: thechars.readTable()
try:
if os.stat(knownFile).st_mtime > os.stat(dumpFile).st_mtime: thechars.readKnown()
except OSError: pass
try:
if os.stat(reviseFile).st_mtime > os.stat(dumpFile).st_mtime: thechars.readRevise()
except OSError: pass
updateSessionLen()
else:
thechars=CharDbase()
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
if self.path.startswith("/fav"):
self.send_response(404) ; self.end_headers() ; return
self.send_response(200)
self.send_header("Content-type","text/html; charset="+thechars.charset)
self.end_headers()
if self.path.startswith("/quit"):
r=thechars.processRequest("/status")
r=r[:r.index("<body>")+6]+"Server terminating."+r[r.index("<body>")+6:]
self.wfile.write(r)
thread.start_new_thread(terminate_server,()) # can terminate the server after this request
else: self.wfile.write(thechars.processRequest(self.path))
self.wfile.close() # needed or will wait for bkg speaking processes etc
def do_session():
portNo = firstPortNo ; server = None
while portNo < firstPortNo+100:
try:
server = BaseHTTPServer.HTTPServer((listenAddr,portNo),RequestHandler)
break
except socket.error: portNo += 1
assert server, "Couldn't find a port to run the server on"
if ("win" not in sys.platform) and commands.getoutput("which x-www-browser 2>/dev/null"): # (try to find x-www-browser, but not on windows/cygwin/darwin)
os.system("x-www-browser http://localhost:%d/%s &" % (portNo,str(random.random()))) # shouldn't need a sleep as should take a while to start anyway
else:
try:
import webbrowser
webbrowser.open_new("http://localhost:%d/%s" % (portNo,str(random.random())))
except ImportError: pass # fall through to command-line message
# Do this as well, in case that command failed:
print ; print ; print
print "Server running. If a web browser does not appear automatically,"
print "please start one yourself and go to"
print "http://localhost:%d/%d" % (portNo,random.randint(1,99999))
print ; print ; print
server.serve_forever()
if sys.argv[-1]=='--count':
x,y,sec,insec=thechars.countKnown()
print "%d (of which %d seem secure)" % (x,len(sec))
elif sys.argv[-1]=='--show-secure':
x,y,sec,insec=thechars.countKnown()
print " ".join(sec)
elif sys.argv[-1]=='--show-wfx':
# the result of this might need charset conversion
# (and the conversion of charlearn scores to Wenlin histories is only approximate)
print """<?xml version='1.0'?>
<!-- Wenlin Flashcard XML file -->
<stack owner='Anonymous' reward='points'>"""
thechars.chars.sort(byPriority)
for c in thechars.chars:
print "<card type='d'><question>"+c.hanzi+"</question>"
trials = "" ; score = 0
if c.supposedToKnow:
if c.priority < 0:
trials += "n"
p = priorityIfGotWrong
while p < c.priority:
trials += "y" ; score += 1
p /= 2
p = 1
while p < c.priority:
trials += "y" ; score += 1
p *= 2
print "<history score='%d' trials='%d' recent='%s'></history></card>" % (score,len(trials),trials)
print "</stack>"
else: do_session()
charset: euc-jp
あ a
い i
う u
え e
お o
か ka
き ki
く ku
け ke
こ ko
さ sa
し shi
す su
せ se
そ so
た ta
ち chi
つ tsu
て te
と to
な na
に ni
ぬ nu
ね ne
の no
は ha
ひ hi
ふ fu
へ he
ほ ho
ま ma
み mi
む mu
め me
も mo
や ya
ゆ yu
よ yo
ら ra
り ri
る ru
れ re
ろ ro
わ wa
を wo
ん n
ア a
イ i
ウ u
エ e
オ o
カ ka
キ ki
ク ku
ケ ke
コ ko
サ sa
シ shi
ス su
セ se
ソ so
タ ta
チ chi
ツ tsu
テ te
ト to
ナ na
ニ ni
ヌ nu
ネ ne
ノ no
ハ ha
ヒ hi
フ fu
ヘ he
ホ ho
マ ma
ミ mi
ム mu
メ me
モ mo
ヤ ya
ユ yu
ヨ yo
ラ ra
リ ri
ル ru
レ re
ロ ro
ワ wa
ヲ wo
ン n
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment