data: import 337 expression/functional phrases from Friends (verified) + 211 common spoken grammar errors

This commit is contained in:
Lang
2026-10-14 21:50:18 +08:00
parent c16a2b3ecf
commit 8e0ec44442
4 changed files with 769 additions and 0 deletions
+2
View File
@@ -185,6 +185,8 @@ actions/ 工作台:指令 + 模板 + 工具 + 素材
├─ langdb.py 读写 me/lang.db(ingest / export / migrate-md)
├─ import_wordlists.py 导入单词表(wordlist:mahavivo)
├─ import_phrases.py 导入短语表(phrases:2ndLA)
├─ import_friends.py 从 Friends 剧本提取表达/功能语(friends:fangj)
├─ import_grammar_errors.py 登记常见口语语法错误(grammar_fixes)
└─ build_dashboard.py 读 me/lang.db → me/dashboard/
logs/ 训练记录(真实 session)
```
+492
View File
@@ -0,0 +1,492 @@
#!/usr/bin/env python3
"""从 Friends 全季剧本(fangj.github.io/friends)提取「表达 / 功能语」并入库。
求真务实:下面是一份**功能语清单**,每条都用 Friends 全季语料**逐条验证**,
只保留真正出现过的(并把出现次数写进 context 作为证据)。
- kind = "expression",function = 功能标签,source = "friends:fangj"
- id = e-<5位数字>(不含 0,出现越多号越小),status = "new"
- level 由短语中「最难的词」的考试级别推得(查 items 的 word 表)
用法:
python actions/import_friends.py
"""
from __future__ import annotations
import datetime as _dt
import glob
import html
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(Path(__file__).resolve().parent))
import langdb # noqa: E402
from import_wordlists import no0_numbers # noqa: E402
CORPUS = ROOT / "actions" / "raw" / "friends"
LEVELS = ["小学", "中考", "高考", "CET4", "CET6", "考研", "TOEFL", "GRE"]
ORDER = {n: i for i, n in enumerate(LEVELS)}
# phrase||function (功能标签)
SEED = """
i mean||话语标记
you know||话语标记
you see||话语标记
kind of||话语标记
sort of||话语标记
you know what||话语标记
if you know what i mean||话语标记
know what i mean||话语标记
the thing is||话语标记
the point is||话语标记
what i mean is||话语标记
or something||话语标记
or whatever||话语标记
and stuff||话语标记
and everything||话语标记
and all that||话语标记
don't get me wrong||话语标记
no offense||话语标记
by the way||转题
speaking of which||转题
that reminds me||转题
come to think of it||转题
as a matter of fact||强调
in fact||强调
i guess||不确定
i suppose||不确定
i bet||不确定
i wonder||不确定
i'm not sure||不确定
i'm afraid||不确定
i have no idea||不确定
who knows||不确定
god knows||不确定
beats me||不确定
as far as i know||不确定
yeah||附和
yep||附和
yup||附和
sure||附和
exactly||附和
absolutely||附和
totally||附和
definitely||附和
of course||附和
for sure||附和
you bet||附和
i know||附和
i agree||附和
tell me about it||附和
no kidding||附和
you're telling me||附和
i hear you||附和
same here||附和
me too||附和
that's right||附和
that's true||附和
good point||附和
fair enough||附和
sounds good||附和
sounds great||附和
works for me||附和
count me in||附和
why not||附和
sure thing||附和
no problem||礼貌
my pleasure||礼貌
you're welcome||礼貌
no way||反对
not really||反对
i don't think so||反对
i doubt it||反对
come on||催促
give me a break||反对
are you kidding||反对
are you serious||反对
you've got to be kidding||反对
yeah right||反对
whatever||反对
forget it||结束话题
never mind||结束话题
no thanks||礼貌
i'd rather not||反对
not a chance||反对
over my dead body||反对
that's not fair||反对
mind your own business||反对
knock it off||制止
cut it out||制止
stop it||制止
excuse me||注意
guess what||注意
check this out||注意
look at this||注意
pardon||请求重复
pardon me||请求重复
come again||请求重复
say what||请求重复
what did you say||请求重复
what was that||请求重复
what do you mean||请求重复
how come||提问
what for||提问
since when||质疑
who cares||无所谓
what's up||问候
what's going on||提问
what's the matter||关心
what's wrong||关心
what happened||提问
unless||条件
in case||条件
as long as||条件
so long as||条件
if only||条件
even if||条件
whether or not||条件
suppose||条件
what if||条件
if i were you||条件
if you ask me||条件
if you don't mind||条件
if you say so||条件
in that case||条件
otherwise||条件
or else||条件
provided that||条件
even though||转折
although||转折
though||转折
however||转折
whereas||转折
on the other hand||转折
then again||转折
that said||转折
on second thought||转折
all the same||让步
besides||递进
what's more||递进
on top of that||递进
not to mention||递进
in addition||递进
furthermore||递进
let alone||递进
to make matters worse||递进
better yet||递进
for example||举例
for instance||举例
such as||举例
let's say||举例
in other words||举例
that is||举例
first of all||时序
at first||时序
to begin with||时序
after that||时序
afterward||时序
meanwhile||时序
in the meantime||时序
at the same time||时序
sooner or later||时序
eventually||时序
in the end||时序
at last||时序
all of a sudden||时序
right away||时序
in a minute||时序
in a second||时序
from now on||时序
once in a while||时序
every now and then||时序
for a while||时序
in the long run||时序
thanks a lot||礼貌
thank you so much||礼貌
i'm sorry||礼貌
i apologize||礼貌
forgive me||礼貌
do you mind||礼貌
would you mind||礼貌
after you||礼貌
go ahead||礼貌
bless you||礼貌
congratulations||礼貌
good luck||礼貌
take care||礼貌
nice to meet you||礼貌
how are you||礼貌
how's it going||礼貌
how do you do||礼貌
have a nice day||礼貌
see you later||礼貌
see you soon||礼貌
good morning||礼貌
good night||礼貌
happy birthday||礼貌
oh my god||感叹
oh my||感叹
oh god||感叹
my god||感叹
for god's sake||感叹
oh no||感叹
oh yeah||感叹
oh boy||感叹
oh well||感叹
oh dear||感叹
wow||感叹
whoa||感叹
jeez||感叹
geez||感叹
damn||感叹
damn it||感叹
crap||感叹
shoot||感叹
ugh||感叹
oops||感叹
thank god||感叹
what the hell||感叹
what the heck||感叹
holy cow||感叹
hold on||推进
hang on||推进
hold it||推进
wait a minute||推进
wait a second||推进
wait up||推进
give me a second||推进
let me see||推进
let me think||推进
let's see||推进
go on||推进
hurry up||推进
shut up||制止
be quiet||制止
calm down||安抚
take it easy||安抚
take your time||安抚
slow down||安抚
cheer up||安抚
grow up||制止
wake up||催促
sit down||动作
stand up||动作
come over||动作
go away||动作
get out||动作
get up||动作
give up||动作
move on||推进
skip it||结束话题
drop it||结束话题
where were we||推进
my turn||推进
your turn||推进
up to you||推进
a little||程度
a lot||程度
a bit||程度
a couple of||数量
a piece of||数量
a bunch of||数量
a lot of||数量
plenty of||数量
tons of||数量
at least||程度
at most||程度
at all||程度
at times||频率
at the moment||时间
for good||时间
for real||强调
for now||时间
for once||频率
in general||概括
in particular||强调
in public||场合
in private||场合
in person||场合
in advance||时间
in time||时间
on time||时间
on purpose||意图
out of the blue||习语
out of control||习语
out of the question||习语
no wonder||习语
no big deal||习语
big deal||习语
make sense||习语
make sure||习语
make up your mind||习语
take a look||动作
take a break||动作
take a seat||动作
have a look||动作
have fun||习语
good for you||鼓励
way to go||鼓励
nice work||鼓励
well done||鼓励
my bad||承认
fair enough||接受
sounds like a plan||接受
long story short||习语
easier said than done||习语
better late than never||习语
no pain no gain||习语
piece of cake||习语
speak of the devil||习语
what's done is done||习语
so far so good||习语
first things first||习语
last but not least||习语
catch you later||礼貌
take it or leave it||习语
i'm out||习语
i'm in||附和
i'm on it||回应
i'm not buying it||反对
don't mention it||礼貌
what a shame||感叹
what a coincidence||感叹
no offense taken||回应
it depends||回应
depends on||回应
no idea||不确定
i'll see||回应
we'll see||回应
let me know||请求
keep in touch||礼貌
hit me||回应
you wish||反对
in your dreams||反对
dream on||反对
get lost||制止
buzz off||制止
chill out||安抚
hang out||动作
show up||动作
turn up||动作
end up||动作
figure out||动作
freak out||动作
check out||动作
find out||动作
work out||动作
point out||动作
run out||动作
put up with||动作
look forward to||动作
come up with||动作
get along||动作
get over||动作
get through||动作
take over||动作
look up||动作
look into||动作
hold up||动作
mess up||动作
screw up||动作
bring up||动作
break up||动作
make out||动作
turn out||动作
call off||动作
put off||动作
give in||动作
give it a shot||鼓励
give it a try||鼓励
take a chance||鼓励
play it cool||习语
keep it down||制止
knock on wood||习语
fingers crossed||习语
no hard feelings||和好
let bygones be bygones||和好
"""
def strip_tags(s: str) -> str:
s = re.sub(r"(?s)<[^>]+>", " ", s)
return html.unescape(s).replace("\u2019", "'").replace("\u2018", "'")
def load_corpus() -> str:
parts = []
for f in glob.glob(str(CORPUS / "season" / "*.html")):
t = strip_tags(Path(f).read_text(encoding="latin-1"))
for line in re.split(r"[\n\r]+", t):
line = line.strip()
if not line:
continue
line = re.sub(r"^[A-Za-z][A-Za-z .'\-]{0,20}:\s*", "", line)
line = re.sub(r"\[[^\]]*\]", " ", line)
line = re.sub(r"\([^)]*\)", " ", line)
line = re.sub(r"\s+", " ", line).strip()
if line:
parts.append(line)
return "\n".join(parts).lower()
def main() -> int:
for st in (sys.stdout, sys.stderr):
try:
st.reconfigure(encoding="utf-8")
except (AttributeError, ValueError):
pass
text = load_corpus()
seed = []
seen = set()
for ln in SEED.strip().splitlines():
if "||" not in ln:
continue
p, fn = ln.split("||", 1)
p = p.strip().lower()
if p and p not in seen:
seen.add(p)
seed.append((p, fn.strip()))
# 逐条验证出现次数
rows = []
for phrase, fn in seed:
cnt = len(re.findall(r"\b" + re.escape(phrase).replace(r"\ ", r"\s+") + r"\b", text))
if cnt > 0:
rows.append({"phrase": phrase, "fn": fn, "count": cnt})
rows.sort(key=lambda r: (-r["count"], r["phrase"]))
# 用 word 表推 level(取短语里最难的词)
conn = langdb.connect()
wl = {r["item"]: r["level"] for r in conn.execute(
"SELECT item, level FROM items WHERE kind='word' AND source LIKE 'wordlist:%'")}
today = _dt.date.today().isoformat()
nums = no0_numbers()
items = []
for r in rows:
lv = ""
for w in re.findall(r"[a-z]+", r["phrase"]):
if w in wl and wl[w] in ORDER:
if not lv or ORDER[wl[w]] > ORDER[lv]:
lv = wl[w]
items.append({
"id": "e-" + next(nums), "kind": "expression", "item": r["phrase"],
"level": lv, "meaning": "", "context": f"Friends 全季 ×{r['count']}",
"status": "new", "first": "", "fix": "", "function": r["fn"],
"tags": "口语," + r["fn"], "source": "friends:fangj",
"added": today, "hits": 0, "streak": 0, "next_review": None,
})
removed = conn.execute("DELETE FROM items WHERE source LIKE 'friends:%'").rowcount
n = langdb.ingest(conn, {"items": items})
conn.close()
print(f"清单 {len(seed)} 条 → 语料验证通过 {len(rows)} 条(≥1 次)")
print(f"清除旧朋友条目 {removed},导入 {n['items']};id {items[0]['id']} → {items[-1]['id']}")
print("Top10:", [(r['phrase'], r['count']) for r in rows[:10]])
return 0
if __name__ == "__main__":
sys.exit(main())
+275
View File
@@ -0,0 +1,275 @@
#!/usr/bin/env python3
"""登记 200 条常见**口语语法错误**到 me/lang.db 的 grammar_fixes 表。
格式:category||issue||rule||examples(✗ 错 → ✓ 对)
id = g-<5位数字>(不含 0);status = learning。
用法:
python actions/import_grammar_errors.py
"""
from __future__ import annotations
import datetime as _dt
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(Path(__file__).resolve().parent))
import langdb # noqa: E402
from import_wordlists import no0_numbers # noqa: E402
RAW = """
主谓一致||第三人称单数漏 -s||he/she/it + 动词加 -s;否定用 doesn't||✗ he don't know → ✓ he doesn't know
主谓一致||第三人称单数 have→has||he/she/it 用 has||✗ she have a car → ✓ she has a car
主谓一致||they/we/you was||复数主语用 were||✗ they was late → ✓ they were late
主谓一致||you was||you 一律用 were||✗ you was right → ✓ you were right
主谓一致||there is + 复数||复数名词用 there are||✗ there is many people → ✓ there are many people
主谓一致||each/every + 复数动词||each/every 后接单数动词||✗ every student have a book → ✓ every student has a book
主谓一致||neither of ... + 复数动词||neither of + 复数名词,动词用单数||✗ neither of them are here → ✓ neither of them is here
主谓一致||a number of ... + 单数动词||a number of + 复数名词,动词用复数||✗ a number of people is coming → ✓ are coming
主谓一致||the number of ... + 复数动词||the number of + 复数名词,动词用单数||✗ the number of cars are rising → ✓ is rising
主谓一致||one of the + 复数名词 + 单数动词||one of the Xs + 单数动词||✗ one of my friends are here → ✓ is here
主谓一致||主语后插入语不影响动词||with/along with 不改变动词数||✗ the teacher with the students are → ✓ is
主谓一致||either ... or 就近原则||either A or B 由 B 决定动词||✗ either you or he are wrong → ✓ is wrong
时态||一般过去误用原形||过去时间用过去式||✗ yesterday I go there → ✓ went there
时态||不规则动词过去式||eat→ate, go→went, take→took||✗ I goed → ✓ I went
时态||since + 一般过去||since 引导用现在完成||✗ I live here since 2010 → ✓ I have lived
时态||for + 时间段误用过去||for + 时间段常配完成时||✗ I know him for ten years → ✓ have known
时态||already/just 与完成时||already/just 常配完成时||✗ I already ate → ✓ I have already eaten
时态||yet 用于否定/疑问||yet 配完成时||✗ I didn't finish yet → ✓ haven't finished yet
时态||过去完成漏用||先发生的过去动作用 had + 过去分词||✗ he leave before I came → ✓ had left
时态||现在完成 + 过去时间||完成时不能配明确过去时间||✗ I have seen him yesterday → ✓ saw him yesterday
时态||静态动词用进行时||know/like/believe 一般不用进行时||✗ I am knowing the answer → ✓ I know
时态||时间从句误用将来||when/after/before 从句用现在时||✗ when I will arrive → ✓ when I arrive
时态||条件从句误用将来||if 从句用现在时||✗ if it will rain → ✓ if it rains
时态||主将从现||主句将来,从句现在||✗ I will call you when I will get home → ✓ when I get home
时态||进行时漏 be||进行时 be + doing||✗ I going now → ✓ I am going now
时态||完成时漏 have||完成时 have + 过去分词||✗ I finished already → ✓ I have finished
时态||过去分词误用过去式||have + 过去分词||✗ I have went → ✓ I have gone
时态||was/were + 过去分词||被动/完成用过去分词||✗ it was wrote → ✓ it was written
时态||进行时误用原形||be + 现在分词||✗ he is go → ✓ he is going
冠词||单数可数名词漏冠词||单数可数名词前加 a/the||✗ I have car → ✓ I have a car
冠词||泛指误用 the||首次泛指用 a/an||✗ I saw the dog in the park (泛指) → ✓ a dog
冠词||特指漏 the||特指/再次提到用 the||✗ open door → ✓ open the door
冠词||不可数名词加 a||不可数名词不加 a/an||✗ a information → ✓ information
冠词||a/an 按音素选择||元音音素用 an||✗ a hour → ✓ an hour
冠词||a 后接元音音素||辅音音素用 a||✗ an university → ✓ a university
冠词||三餐/球类/学科前不加 the||have breakfast / play football||✗ play the football → ✓ play football
冠词||乐器前加 the||play the piano||✗ play piano → ✓ play the piano
冠词||独一无二事物加 the||the sun / the moon||✗ sun is bright → ✓ the sun
冠词||固定短语的冠词||go to school / at night / by bus||✗ by the bus → ✓ by bus
冠词||the + 形容词表一类||the rich / the young||✗ rich should help poor → ✓ the rich … the poor
名词数||不可数名词加 s||information/advice/furniture 不加 s||✗ informations → ✓ information
名词数||advice 不可数||a piece of advice||✗ an advice → ✓ a piece of advice
名词数||furniture 不可数||a piece of furniture||✗ furnitures → ✓ furniture
名词数||equipment 不可数||a piece of equipment||✗ equipments → ✓ equipment
名词数||news 不可数||a piece of news||✗ a news → ✓ a piece of news
名词数||homework 不可数||homework 不加 s||✗ homeworks → ✓ homework
名词数||bread 不可数||two pieces/loaves of bread||✗ two breads → ✓ two pieces of bread
名词数||money 不可数||much money||✗ many money → ✓ much money
名词数||people 复数||people 本身是复数||✗ much people → ✓ many people
名词数||复合名词复数||mothers-in-law||✗ mother-in-laws → ✓ mothers-in-law
名词数||fish/sheep 单复同形||two fish / two sheep||✗ two fishes(种类除外)→ ✓ two fish
名词数||this/these 单复一致||this + 单数,these + 复数||✗ these book → ✓ these books
名词数||a pair of 后接复数||a pair of shoes||✗ a pair of shoe → ✓ a pair of shoes
代词||主格宾格误用||主语用主格||✗ me and him went → ✓ he and I went
代词||between you and I||介词后用宾格||✗ between you and I → ✓ between you and me
代词||it's 与 its 混用||it's = it is;its 所有格||✗ the dog lost it's bone → ✓ its bone
代词||your 与 you're 混用||your 所有格;you're = you are||✗ your welcome → ✓ you're welcome
代词||their/there/they're 混用||their 所有格;there 那里;they're = they are||✗ there going → ✓ they're going
代词||反身代词误用||I/me 误用 myself||✗ my friend and myself went → ✓ my friend and I went
代词||each other 与 oneself||each other 互相||✗ they help themselves(互相)→ ✓ each other
代词||who 与 whom||whom 作宾语||✗ who did you see → ✓ whom did you see
代词||指代不明||代词要有明确先行词||✗ when I met John, he said …(he 指谁?) → ✓ 明确
代词||everyone 后接单数动词||everyone/everybody + 单数||✗ everyone are here → ✓ everyone is here
比较||双重比较||more + 比较级不叠用||✗ more better → ✓ better
比较||双重最高级||most + 最高级不叠用||✗ the most easiest → ✓ the easiest
比较||as ... as 结构||as + 原级 + as||✗ as taller as → ✓ as tall as
比较||比较级 + than||比较级配 than||✗ taller then him → ✓ taller than he is
比较||less 与 fewer||可数用 fewer||✗ less people → ✓ fewer people
比较||much 修饰比较级||much/a lot + 比较级||✗ very better → ✓ much better
比较||the more ... the more||越…越…||✗ more you practice, more better → ✓ the more you practice, the better
比较||最高级加 the||最高级前 the||✗ he is best student → ✓ the best student
语序||疑问句语序||疑问句助动词提前||✗ where you are going → ✓ where are you going
语序||宾语从句用陈述语序||从句用陈述语序||✗ I don't know where is he → ✓ where he is
语序||副词位置||频度副词在实义动词前||✗ I like very much it → ✓ I like it very much
语序||always/never 位置||在 be 后、实义动词前||✗ he always is late → ✓ he is always late
语序||enough 位置||形容词/副词后、名词前||✗ enough good → ✓ good enough
语序||only 位置影响句意||only 修饰谁放谁前||✗ I only have one dollar(歧义)→ ✓ 明确
语序||too ... to 结构||too + 形容词 + to do||✗ too much tired to go → ✓ too tired to go
语序||疑问词+不定式||how to do 作宾语||✗ I don't know how can I do → ✓ how to do it
情态||should/would + 原形||情态动词后接原形||✗ I should to go → ✓ I should go
情态||must 与 have to||must 主观;have to 客观||✗ I must to work tomorrow(客观)→ ✓ have to
情态||can 与 be able to||将来用 will be able to||✗ I will can do it → ✓ will be able to
情态||would like to||would like + to do||✗ I would like go → ✓ I would like to go
情态||need not 与 don't need to||needn't do = don't need to do||✗ you needn't to go → ✓ needn't go
情态||used to 与 be used to||used to do 过去常常;be used to doing 习惯于||✗ I used to getting up early(过去常常)→ ✓ used to get
情态||had better + 原形||had better do||✗ you had better to rest → ✓ had better rest
情态||may/might 表可能||might 更不确定||✗ he may be there(弱)→ 视语气选 might
情态||mustn't 与 needn't||mustn't 禁止;needn't 不必||✗ you mustn't hurry(不必)→ ✓ needn't
情态||shall 的用法||shall I/we 提议||✗ Shall you help me → ✓ Will you help me
虚拟||if I were you||虚拟用 were||✗ if I was you → ✓ if I were you
虚拟||wish + 过去式||wish 后虚拟||✗ I wish I am rich → ✓ I wish I were rich
虚拟||suggest + (should) 原形||suggest that sb (should) do||✗ I suggest him to go → ✓ suggest that he (should) go
虚拟||insist/demand + 原形||insist/demand that sb do||✗ he insisted me to stay → ✓ insisted that I (should) stay
虚拟||it's time + 过去式||It's time sb did||✗ it's time we go → ✓ it's time we went
虚拟||would rather + 过去式||would rather sb did||✗ I'd rather you come → ✓ came
虚拟||as if + 过去式||as if 虚拟||✗ he talks as if he is boss → ✓ as if he were boss
虚拟||if 虚拟三段||过去→had done/would have done||✗ if I had known, I will tell you → ✓ would have told
非谓语||enjoy + doing||enjoy 后接动名词||✗ I enjoy to read → ✓ enjoy reading
非谓语||finish + doing||finish 后接动名词||✗ I finished to work → ✓ finished working
非谓语||avoid + doing||avoid 后接动名词||✗ avoid to make mistakes → ✓ avoid making
非谓语||mind + doing||mind 后接动名词||✗ do you mind to open → ✓ mind opening
非谓语||look forward to + doing||to 是介词||✗ I look forward to see you → ✓ to seeing you
非谓语||want + to do||want 后接不定式||✗ I want going → ✓ want to go
非谓语||suggest + doing||suggest doing(或 that 从句)||✗ I suggest to go → ✓ suggest going
非谓语||make/let + 原形||使役动词后省 to||✗ he made me to cry → ✓ made me cry
非谓语||help + (to) do||help 后 to 可省||✗ he helped me doing → ✓ (to) do
非谓语||介词后接动名词||介词 + doing||✗ I'm interested in learn → ✓ in learning
非谓语||stop 后 to do/doing 义异||stop to do 停下来去做;stop doing 停止||✗ I stopped to smoke(戒烟)→ ✓ stopped smoking
非谓语||remember 后 to do/doing 义异||remember to do 记得去做;remember doing 记得做过||✗ remember to lock(已锁)→ ✓ remember locking
非谓语||forget 后 to do/doing 义异||forget to do 忘记去做;forget doing 忘记做过||✗ I forgot to see him(见过)→ ✓ forgot seeing
非谓语||need + doing 表被动||need doing = need to be done||✗ the car needs to repair → ✓ needs repairing
形容词副词||副词修饰动词||动作方式用副词||✗ he runs quick → ✓ runs quickly
形容词副词||系动词后接形容词||feel/look/sound + 形容词||✗ I feel badly → ✓ feel bad
形容词副词||good 与 well||well 作副词/健康||✗ he sings good → ✓ sings well
形容词副词||hard 与 hardly||hardly 几乎不||✗ he works hardly → ✓ works hard
形容词副词||late 与 lately||lately 最近||✗ he came lately → ✓ came late
形容词副词||so 与 such||such + 名词;so + 形容词||✗ so beautiful day → ✓ such a beautiful day
形容词副词||too 与 very||too 表过分||✗ he is too kind(很)→ ✓ very kind
形容词副词||interesting 与 interested||物 interesting;人 interested||✗ I'm boring → ✓ I'm bored
形容词副词||a few 与 few||a few 有几个;few 几乎没有||✗ few friends came(有几个)→ ✓ a few
形容词副词||a little 与 little||a little 有一点;little 几乎没有||✗ little money left(还有一点)→ ✓ a little
形容词副词||-ed 与 -ing 形容词||✗ the news is excited → ✓ exciting
形容词副词||比较级修饰||much/far/even + 比较级||✗ more easier → ✓ much easier
连词||although 与 but 不并用||although ... , 不用 but||✗ although he is old, but he works → ✓ although he is old, he works
连词||because 与 so 不并用||because ... , 不用 so||✗ because it rained, so we stayed → ✓ because it rained, we stayed
连词||关联连词成对||both ... and / either ... or||✗ both A as well as B → ✓ both A and B
连词||not only ... but also||结构一致||✗ not only he sings but also dances → ✓ not only does he sing but he also dances
连词||并列结构一致||并列成分同形||✗ I like swimming and to run → ✓ swimming and running
连词||while 表对比/同时||表对比用 while||✗ while I like tea, she likes coffee(对比 ok)→ ✓
连词||and 连接时态一致||✗ he came and sit down → ✓ sat down
从句||关系代词 who/which||人用 who,物用 which/that||✗ the man which called → ✓ who called
从句||关系代词漏掉||定语从句需关系词||✗ the book I bought it is good → ✓ the book I bought is good
从句||关系副词 where/when||先行词是地点/时间||✗ the place which I live → ✓ where I live
从句||whose 所有格||whose + 名词||✗ the man who his car was stolen → ✓ whose car
从句||if 与 whether||介词后/不定式用 whether||✗ it depends on if → ✓ on whether
从句||that 从句不缺成分||that 作宾语可省||✗ the thing that I need it → ✓ that I need
从句||宾语从句时态呼应||主过去从过去(真理除外)||✗ he said he is busy → ✓ he was busy
从句||客观真理用现在||主过去但从现在||✗ he said the earth moved → ✓ moves
否定||否定转移||I don't think + 肯定从句||✗ I think he isn't right → ✓ I don't think he is right
否定||no 与 not||no + 名词;not + 动词/形容词||✗ I have not money → ✓ no money
否定||none 与 no one||none of + 复数;no one 无人||✗ none of them is here(人)→ ✓ no one is here
否定||neither 与 nor||neither ... nor||✗ neither he or I → ✓ neither he nor I
否定||hardly ... when||hardly had ... when||✗ hardly I arrived when → ✓ hardly had I arrived when
否定||all/both 的部分否定||not all / not both||✗ all is not gold(歧义)→ ✓ not all that glitters is gold
中式||open/close the light||开/关灯用 turn on/off||✗ open the light → ✓ turn on the light
中式||how to say||问说法用 How do you say||✗ how to say this in English → ✓ how do you say
中式||very like||like ... very much||✗ I very like it → ✓ I like it very much
中式||I'm agree||agree 是动词||✗ I'm agree with you → ✓ I agree with you
中式||borrow me||借出用 lend||✗ can you borrow me money → ✓ lend me
中式||learn knowledge||获得知识用 gain||✗ learn knowledge → ✓ gain knowledge
中式||very thank you||thank you very much||✗ very thank you → ✓ thank you very much
中式||do a mistake||make a mistake||✗ do a mistake → ✓ make a mistake
中式||do a decision||make a decision||✗ do a decision → ✓ make a decision
中式||take a rest||take a break/rest||✗ take a rest(可)→ ✓ take a break
中式||say me||tell me||✗ say me the truth → ✓ tell me
中式||discuss about||discuss 及物||✗ discuss about it → ✓ discuss it
中式||enter into the room||enter 及物||✗ enter into the room → ✓ enter the room
中式||marry with||marry sb||✗ she married with him → ✓ married him
中式||reply my email||reply to||✗ reply my email → ✓ reply to my email
中式||explain me||explain to me||✗ explain me this → ✓ explain this to me
中式||go to home||go home||✗ go to home → ✓ go home
中式||go to abroad||go abroad||✗ go to abroad → ✓ go abroad
中式||in the same time||at the same time||✗ in the same time → ✓ at the same time
中式||in the other hand||on the other hand||✗ in the other hand → ✓ on the other hand
中式||on the phone||on the phone(对)||✗ by the phone → ✓ on the phone
中式||use the phone||对||✗ play the phone → ✓ use the phone
介词||arrive to||arrive at/in||✗ arrive to the station → ✓ arrive at
介词||depend of||depend on||✗ it depends of you → ✓ depends on
介词||listen music||listen to music||✗ listen music → ✓ listen to music
介词||in Monday||星期用 on||✗ in Monday → ✓ on Monday
介词||on the morning||早晨用 in||✗ on the morning → ✓ in the morning
介词||interested of||interested in||✗ interested of music → ✓ in music
介词||good in||good at||✗ good in math → ✓ good at
介词||different than||different from||✗ different than → ✓ different from
介词||afraid of||afraid of doing||✗ afraid to dogs → ✓ afraid of dogs
介词||angry with people||对人生气用 with||✗ angry on him → ✓ angry with him
介词||married to||married to sb||✗ married with → ✓ married to
介词||contact with||contact sb(及物)||✗ contact with me → ✓ contact me
介词||ask to me||ask me||✗ he asked to me → ✓ asked me
介词||apologize to sb for sth||搭配||✗ apologize him → ✓ apologize to him
介词||provide sb with sth||搭配||✗ provide sb sth(口语可)→ ✓ provide sb with
介词||congratulate sb on||搭配||✗ congratulate you for → ✓ on
介词||spend time on/in||搭配||✗ spend time to → ✓ on/in
介词||on the internet||对||✗ in the internet → ✓ on the internet
介词||at night / at noon||固定搭配||✗ in the night → ✓ at night
介词||by car / on foot||交通方式||✗ by foot → ✓ on foot
介词||between 与 among||两者 between;多者 among||✗ between the three → ✓ among the three
介词||because 与 because of||because + 从句;because of + 名词||✗ because of it rained → ✓ because it rained
时态||be going to 与 will||计划用 be going to;临时决定用 will||✗ I will visit my aunt next week(已计划)→ ✓ am going to
时态||间接引语时态后移||will→would, can→could||✗ he said he will come → ✓ he would come
时态||would 与 used to||would 表过去习惯(非状态)||✗ I would have a dog(过去拥有)→ ✓ used to have
时态||现在完成进行时||动作持续到现在||✗ I am reading since morning → ✓ I have been reading
时态||过去完成与一般过去顺序||先发生用过去完成||✗ when I arrived, he left → ✓ had left
冠词||a 与 one||one 强调数量||✗ I need one pen(泛指)→ ✓ a pen
冠词||再次提及用 the||首次 a,再次 the||✗ I bought a book. A book is good → ✓ The book
语序||also 位置||also 在 be 后、实义动词前||✗ I also am tired → ✓ I am also tired
语序||never 置首倒装||Never have I …||✗ Never I have seen → ✓ Never have I seen
语序||not until 倒装||Not until … did …||✗ Not until then I realized → ✓ did I realize
代词||one/ones 代替||避免重复名词||✗ the blue car → ✓ the blue one
代词||whose 与 who's||whose 所有格;who's = who is||✗ who's book is this → ✓ whose book
名词||police 复数||police 作复数||✗ the police is coming → ✓ are coming
名词||clothes 复数||clothes 作复数||✗ this clothes is new → ✓ these clothes are
名词||people 与 peoples||peoples 指民族||✗ many peoples(人)→ ✓ many people
连词||so that 与 so||目的用 so that||✗ I left early so I catch the bus → ✓ so that I could
连词||unless 与 if not||unless = if not||✗ unless you don't hurry → ✓ unless you hurry
从句||the reason is that||不用 because 作表语从句||✗ the reason is because → ✓ the reason is that
拼写混||then 与 than||than 比较;then 然后||✗ better then that → ✓ better than that
拼写混||to/too/two||too 也/太;two 二||✗ me to → ✓ me too
拼写混||lose 与 loose||lose 丢失;loose 松||✗ don't loose it → ✓ lose
拼写混||advise 与 advice||advise 动词;advice 名词||✗ give me some advise → ✓ advice
拼写混||affect 与 effect||affect 动词;effect 名词||✗ it effected me → ✓ affected
拼写混||lie 与 lay||lie 躺(lie-lay-lain);lay 放(lay-laid-laid)||✗ lay down on the bed → ✓ lie down
拼写混||rise 与 raise||rise 不及物;raise 及物||✗ raise up early → ✓ rise early
"""
def main() -> int:
for st in (sys.stdout, sys.stderr):
try:
st.reconfigure(encoding="utf-8")
except (AttributeError, ValueError):
pass
rows = []
for ln in RAW.strip().splitlines():
ln = ln.strip()
if not ln or "||" not in ln:
continue
parts = ln.split("||")
if len(parts) != 4:
continue
cat, issue, rule, ex = [p.strip() for p in parts]
rows.append({"category": cat, "issue": issue, "rule": rule, "examples": ex})
today = _dt.date.today().isoformat()
nums = no0_numbers()
grammar = []
for r in rows:
grammar.append({
"id": "g-" + next(nums), "category": r["category"], "issue": r["issue"],
"rule": r["rule"], "examples": r["examples"], "status": "learning",
"count": 0, "first": today, "last": today, "next_review": None,
})
conn = langdb.connect()
n = langdb.ingest(conn, {"grammar": grammar})
total = conn.execute("SELECT COUNT(*) FROM grammar_fixes").fetchone()[0]
conn.close()
print(f"登记语法错误 {n['grammar']} 条;grammar_fixes 现有 {total} 条")
print("id:", grammar[0]["id"], "→", grammar[-1]["id"])
return 0
if __name__ == "__main__":
sys.exit(main())
BIN
View File
Binary file not shown.