逻辑改进

This commit is contained in:
2025-08-04 01:24:35 +08:00
parent 4beb42f615
commit c9185fbd0a
6 changed files with 504 additions and 177 deletions

View File

@@ -4,11 +4,11 @@ from textual.widgets import Collapsible, Header, Footer, Markdown, ListView, Lis
from textual.containers import Container, Horizontal, Center from textual.containers import Container, Horizontal, Center
from textual.screen import Screen from textual.screen import Screen
from textual.widget import Widget from textual.widget import Widget
import pathlib import uuid
from typing import Tuple, Dict from typing import Tuple, Dict
import particles as pt import particles as pt
import uuid import puzzles as pz
from functools import wraps import re
class Composition(): class Composition():
def __init__(self, screen: Screen, reactor, atom: Tuple[pt.Electron, pt.Nucleon, Dict]): def __init__(self, screen: Screen, reactor, atom: Tuple[pt.Electron, pt.Nucleon, Dict]):
@@ -24,12 +24,15 @@ class Composition():
if id_ not in self.reg.keys(): if id_ not in self.reg.keys():
return "None" return "None"
return self.reg[id_] return self.reg[id_]
def recid(self, id_):
return id_[:-36]
def compose(self): def compose(self):
yield Label("示例标签", id="testlabel") yield Label("示例标签", id="testlabel")
yield Button("示例按钮", id="testbtn") yield Button("示例按钮", id="testbtn")
def handler(self, event): def handler(self, event, type_):
print(event.button.id) if hasattr(event, "button"):
self.screen.query_one("#testlabel", Label).update("hi") #print(event.button.id)
self.screen.query_one("#testlabel", Label).update("hi")
class Placeholder(Composition): class Placeholder(Composition):
def __init__(self, screen: Screen): def __init__(self, screen: Screen):
@@ -37,8 +40,8 @@ class Placeholder(Composition):
def compose(self): def compose(self):
yield Label("示例标签", id="testlabel") yield Label("示例标签", id="testlabel")
yield Button("示例按钮", id="testbtn", classes="choice") yield Button("示例按钮", id="testbtn", classes="choice")
def handler(self, event): def handler(self, event, type_):
print(event.button.id) #print(event.button.id)
self.screen.query_one("#testlabel", Label).update("hi") self.screen.query_one("#testlabel", Label).update("hi")
class Recognition(Composition): class Recognition(Composition):
@@ -48,17 +51,32 @@ class Recognition(Composition):
with Center(): with Center():
yield Static(f"[dim]{self.atom[1]['translation']}[/]") yield Static(f"[dim]{self.atom[1]['translation']}[/]")
yield Label(f"") yield Label(f"")
with Center(): s = str(self.atom[1]['content'])
yield Label(f"[b][b]{self.atom[1]['content']}[/][/]", id=self.regid("sentence")) # 致敬传奇去重串 uuid replace_dict = {
", ": ",",
". ": ".",
"; ": ";",
": ": ":",
"/,": ",",
"./": ".",
"/;": ";",
";/": ";",
":/": ":",
}
for old, new in replace_dict.items():
s = s.replace(old, new)
result = re.split(r"(?<=[,;:|])", s.replace('/', ' '))
for i in result:
with Center():
yield Label(f"[b][b]{i.replace("/", " ")}[/][/]", id=self.regid("sentence"+str(hash(i)))) # 致敬传奇去重串 uuid
#with Collapsible(title="附加信息", collapsed=True): #with Collapsible(title="附加信息", collapsed=True):
for i in self.atom[2]["testdata"]["additional_inf"]: for i in self.atom[2]["testdata"]["additional_inf"]:
if self.atom[1][i]: if self.atom[1][i]:
print(type(self.atom[1][i])) #print(type(self.atom[1][i]))
print(self.atom[1][i]) #print(self.atom[1][i])
if isinstance(self.atom[1][i], list): if isinstance(self.atom[1][i], list):
for j in self.atom[1][i]: for j in self.atom[1][i]:
print(999) yield Markdown(f"### {self.atom[2]['keydata'][i]}: {j}")
yield Markdown(f"### {self.atom[2]["keydata"][i]}: {j}")
continue continue
if isinstance(self.atom[1][i], Dict): if isinstance(self.atom[1][i], Dict):
t = "" t = ""
@@ -67,33 +85,52 @@ class Recognition(Composition):
yield Markdown(t, id=self.regid("tran")) yield Markdown(t, id=self.regid("tran"))
with Center(): with Center():
yield Button("我已知晓", id=self.regid("ok")) yield Button("我已知晓", id=self.regid("ok"))
def handler(self, event): def handler(self, event, type_):
if event.button.id == self.getid("ok"): ##print(event)
print(1) if type_ == "button":
""""""#assessment = self.reactor.report(self.reactor.current_atom, -1) #print(event.button.id)
return 0 if event.button.id == self.getid("ok"):
#print(1)
""""""#assessment = self.reactor.report(self.reactor.current_atom, -1)
return 0
if type_ == 1:
pass
return -1
class BasicEvaluation(Composition): class BasicEvaluation(Composition):
def __init__(self, screen: Screen, reactor, atom: Tuple[pt.Electron, pt.Nucleon, Dict]): def __init__(self, screen: Screen, reactor, atom: Tuple[pt.Electron, pt.Nucleon, Dict]):
super().__init__(screen, reactor, atom) super().__init__(screen, reactor, atom)
def compose(self): def compose(self):
yield Label(self.atom[1]["content"], id="sentence") yield Label(self.atom[1]["content"], id="sentence")
for i in self.atom[2]["testdata"]["additional_inf"]: with Container(id="button_container"):
yield Label(f"{self.atom[2]["keydata"][i]}: {self.atom[1][i]}", id=f"label_{i}") btn = {}
yield Button("我已知晓", id="ok") btn['5'] = Button("完美回想", variant="success", id=self.regid("feedback5"), classes="choice")
def handler(self, event): btn['4'] = Button("犹豫后正确", variant="success", id=self.regid("feedback4"), classes="choice")
if event.button.id == "ok": btn['3'] = Button("困难地正确", variant="warning", id=self.regid("feedback3"), classes="choice")
return 1 btn['2'] = Button("错误但熟悉", variant="warning", id=self.regid("feedback2"), classes="choice")
btn['1'] = Button("错误且不熟", variant="error", id=self.regid("feedback1"), classes="choice")
btn['0'] = Button("完全空白", variant="error", id=self.regid("feedback0"), classes="choice")
yield Horizontal(btn['5'], btn['4'])
yield Horizontal(btn['3'], btn['2'])
yield Horizontal(btn['1'], btn['0'])
def handler(self, event, type_):
if "feedback" in event.button.id:
#print(self.recid(event.button.id)[8:9])
assess = int(self.recid(event.button.id)[8:9])
ret = self.reactor.report(self.atom, assess)
return ret
class FillBlank(Composition): class FillBlank(Composition):
def __init__(self, screen: Screen, atom: Tuple[pt.Electron, pt.Nucleon, Dict]): def __init__(self, screen: Screen, reactor, atom: Tuple[pt.Electron, pt.Nucleon, Dict]):
""""""#super().__init__(screen, atom) super().__init__(screen, reactor, atom)
def _work(self):
self.puzzle = pz.BlankPuzzle(self.atom[1]["content"], 4)
self.puzzle.refresh()
def compose(self): def compose(self):
yield Label(self.atom[1]["content"], id="sentence") self._work()
for i in self.atom[2]["testdata"]["additional_inf"]: yield Label(self.puzzle.wording, id="sentence")
yield Label(f"{self.atom[2]["keydata"][i]}: {self.atom[1][i]}", id=f"label_{i}")
yield Button("我已知晓", id="ok") yield Button("我已知晓", id="ok")
def handler(self, event): def handler(self, event, type_):
if event.button.id == "ok": if event.button.id == "ok":
return 1 return 1
@@ -101,7 +138,7 @@ class FillBlank(Composition):
registry = { registry = {
"sample": Composition, "sample": Composition,
"recognition": Recognition, "recognition": Recognition,
"fill_blank_test": FillBlank, "fill_blank_test": BasicEvaluation,
"draw_card_test": BasicEvaluation, "draw_card_test": BasicEvaluation,
"basic_evaluation": BasicEvaluation, "basic_evaluation": BasicEvaluation,
} }
@@ -121,7 +158,7 @@ class TestScreen(Screen):
pass pass
def on_button_pressed(self, event: Event) -> None: def on_button_pressed(self, event: Event) -> None:
self.comp.handler(event) self.comp.handler(event, "button")
def action_quit_app(self) -> None: def action_quit_app(self) -> None:
self.app.exit() self.app.exit()

View File

@@ -0,0 +1,279 @@
["臣/密/言: /臣/以/险衅/, 夙/遭/闵凶./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241563.9242582
["生孩/六月/, 慈父/见背/; /行年/四岁/, 舅/夺/母志./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241564.467116
["祖母/刘/愍/臣/孤弱/, 躬亲/抚养./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241565.3159063
["臣/少/多/疾病/, 九岁/不行/, 零丁/孤苦/, 至于/成立./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241566.100317
["既/无/伯叔/, 终/鲜/兄弟/, 门/衰/祚/薄/, 晚/有/儿息./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241566.9799266
["外/无/期功/强近/之亲/, 内/无/应门/五尺/之僮/, 茕茕/孑立/, 形影/相吊./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241567.6606886
["而/刘/夙/婴/疾病/, 常/在/床蓐/, 臣/侍/汤药/, 未曾/废离./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241568.2600803
["逮/奉/圣朝/, 沐浴/清化./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241568.6842272
["前/太守/臣/逵/察/臣/孝廉/; /后/刺史/臣/荣/举/臣/秀才./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241569.060461
["臣/以/供养/无主/, 辞/不赴命./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241569.4603384
["诏书/特下/, 拜/臣/郎中/, 寻/蒙/国恩/, 除/臣/洗马./"]
efactor = 2.5
real_rept = 2
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241569.8361027
["猥/以/微贱/, 当/侍/东宫/, 非/臣/陨首/所能/上报./"]
efactor = 2.5
real_rept = 6
rept = 0
interval = 1
last_date = 10
next_date = 11
is_activated = 1
last_modify = 1754241571.6039598
["臣/具/以表/闻/, 辞/不就职./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075471
["诏书/切峻/, 责/臣/逋慢/; /郡县/逼迫/, 催/臣/上道/; /州司/临门/, 急于/星火./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.007548
["臣/欲/奉诏/奔驰/, 则/刘/病/日笃/, 欲/苟/顺/私情/, 则/告诉/不许./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075495
["臣/之/进退/, 实为/狼狈./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075507
["伏惟/圣朝/以/孝/治/天下/, 凡/在/故老/, 犹/蒙/矜育/, 况/臣/孤苦/, 特为/尤甚./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075517
["且/臣/少/仕/伪朝/, 历职/郎署/, 本图/宦达/, 不矜/名节./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075529
["今/臣/亡国/贱俘/, 至微/至陋/, 过/蒙/拔擢/, 宠命/优渥/, 岂敢/盘桓/, 有所/希冀!/"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075538
["但/以/刘/日薄/西山/, 气息/奄奄/, 人命/危浅/, 朝不/虑夕./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075545
["臣/无/祖母/, 无以/至今日/, 祖母/无/臣/, 无以/终余年./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075557
["母孙/二人/, 更相/为命/, 是以/区区/不能/废远./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.007557
["臣/密/今年/四十/有四/, 祖母/今年/九十/有六/, 是/臣/尽节/于/陛下/之日/长/, 报养/刘/之日/短./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.007558
["乌鸟/私情/, 愿/乞/终养./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075595
["臣/之/辛苦/, 非独/蜀之/人士/及/二州/牧伯/所见/明知/, 皇天/后土/, 实所/共鉴./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075607
["愿/陛下/矜悯/愚诚/, 听/臣/微志/, 庶/刘/侥幸/, 保/卒/余年./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.0075655
["臣/生/当/陨首/, 死/当/结草./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.007567
["臣/不胜/犬马/怖惧/之情/, 谨/拜表/以闻./"]
efactor = 2.5
real_rept = 0
rept = 0
interval = 0
last_date = 0
next_date = 0
is_activated = 0
last_modify = 1754241555.007568

63
main.py
View File

@@ -1,12 +1,11 @@
from textual.app import App, ComposeResult from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, ListView, DirectoryTree, ListItem, Label, Static, Button from textual.widgets import Header, Footer, ListView, ProgressBar, DirectoryTree, ListItem, Label, Static, Button
from textual.containers import Container, Horizontal from textual.containers import Container, Horizontal, Center
from textual.screen import Screen from textual.screen import Screen
import pathlib import pathlib
import threading import threading
import edge_tts as tts import edge_tts as tts
from playsound import playsound from playsound import playsound
from textual.logging import TextualHandler
import particles as pt import particles as pt
from reactor import Reactor, Apparatus from reactor import Reactor, Apparatus
@@ -46,17 +45,19 @@ class MemScreen(Screen):
self.reactor = Reactor(nucleon_file, electron_file, self, tasked_num) self.reactor = Reactor(nucleon_file, electron_file, self, tasked_num)
self.stage = 1 self.stage = 1
self.stage += self.reactor.set_round_templated(self.stage) self.stage += self.reactor.set_round_templated(self.stage)
#print(self.reactor.procession) ##print(self.reactor.procession)
self.reactor.forward() self.reactor.forward()
#self.compo:compo.Composition = compo.Placeholder(self) #self.compo:compo.Composition = compo.Placeholder(self)
self.compo = next(self.reactor.current_appar) self.compo = next(self.reactor.current_appar)
def compose(self) -> ComposeResult: def compose(self) -> ComposeResult:
print(self.compo) #print(self.compo)
yield Header(show_clock=True) yield Header(show_clock=True)
with Container(id="main_container"): with Center():
yield from self.compo.compose() yield Static(f"{len(self.reactor.procession) - self.reactor.index}/{len(self.reactor.procession)}")
#yield ProgressBar(total=len(self.reactor.procession) - 1, show_percentage=False, show_eta=False, id="progress")
yield from self.compo.compose()
yield Footer() yield Footer()
""" """
@@ -69,27 +70,23 @@ class MemScreen(Screen):
pass pass
def on_button_pressed(self, event): def on_button_pressed(self, event):
ret = self.compo.handler(event) ret = self.compo.handler(event, "button")
"""feedback_label = self.query_one("#feedback", Static) self._forward_judge(ret)
if type(event) == str:
btnid = event def _forward_judge(self, ret):
else: if ret == -1:
btnid = event.button.id return
btnid = str(btnid)
quality = int(btnid.replace('q', ''))
assessment = self.reactor.report(self.reactor.current_atom, quality)
"""
# 遵循 perror 返回值规则
if ret == 0: # 成功 if ret == 0: # 成功
try: try:
self.compo = next(self.reactor.current_appar) self.compo = next(self.reactor.current_appar)
self.refresh_ui() self.refresh_ui()
except StopIteration: except StopIteration:
nxt = self.reactor.forward(1) nxt = self.reactor.forward(1)
print(2) #print(2)
self.compo = next(self.reactor.current_appar) try:
print(self.compo) self.compo = next(self.reactor.current_appar)
#print("next", nxt, self.reactor.current_atom) except:
pass
if nxt == -1: if nxt == -1:
if self.reactor.round_set == 0: if self.reactor.round_set == 0:
if self.stage == 4: if self.stage == 4:
@@ -101,6 +98,8 @@ class MemScreen(Screen):
self.reactor.forward(1) self.reactor.forward(1)
#self._update_ui() #self._update_ui()
self.stage += 1 self.stage += 1
self.compo = next(self.reactor.current_appar)
self.refresh_ui()
return return
return return
else: else:
@@ -109,14 +108,14 @@ class MemScreen(Screen):
if ret == 1: # 不允许前进 if ret == 1: # 不允许前进
self.refresh_ui() self.refresh_ui()
return return
def refresh_ui(self): def refresh_ui(self):
area = self.query_one("#main_container")
self.call_later(self.recompose) self.call_later(self.recompose)
#print(area.children) #self.call_later(lambda: self.query_one("#progress", expect_type=ProgressBar).advance(self.reactor.index))
##print(area.children)
#for child in list(area.children): #for child in list(area.children):
# child.remove() # 致敬传奇组件树 DOM # child.remove() # 致敬传奇组件树 DOM
#print(1,list(self.compo.compose())) ##print(1,list(self.compo.compose()))
#area.mount(*list(self.compo.compose())) #area.mount(*list(self.compo.compose()))
def report(self, quality): def report(self, quality):
@@ -143,17 +142,17 @@ class MemScreen(Screen):
#feedback_label.update("") # 清除反馈消息 #feedback_label.update("") # 清除反馈消息
self._update_ui()""" self._update_ui()"""
def action_press(self, btnid): #def action_press(self, btnid):
self.on_button_pressed(btnid) # self.on_button_pressed(btnid)
def action_play_voice(self): def action_play_voice(self):
def play(): def play():
cache_dir = pathlib.Path(f"./cache/voice/") cache_dir = pathlib.Path(f"./cache/voice/")
cache_dir.mkdir(parents = True, exist_ok = True) cache_dir.mkdir(parents = True, exist_ok = True)
cache = cache_dir / f"{self.reactor.current_atom[1].content}.wav" cache = cache_dir / f"{self.reactor.current_atom[1].content.replace("/","")}.wav"
if not cache.exists(): if not cache.exists():
communicate = tts.Communicate(self.reactor.current_atom[1].content, "zh-CN-YunjianNeural") communicate = tts.Communicate(self.reactor.current_atom[1].content.replace("/",""), "zh-CN-YunjianNeural")
communicate.save_sync(f"./cache/voice/{self.reactor.current_atom[1].content}.wav") communicate.save_sync(f"./cache/voice/{self.reactor.current_atom[1].content.replace("/","")}.wav")
playsound(str(cache)) playsound(str(cache))
threading.Thread(target=play).start() threading.Thread(target=play).start()
@@ -267,7 +266,7 @@ class AppLauncher(App):
} }
def on_mount(self) -> None: def on_mount(self) -> None:
self.action_toggle_dark() #self.action_toggle_dark()
self.push_screen("file_selection_screen") self.push_screen("file_selection_screen")
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -13,142 +13,142 @@ fill_blank_test = ["translation"]
# 选择题测试 # 选择题测试
draw_card_test = ["keyword_note"] draw_card_test = ["keyword_note"]
["臣密言:臣以险衅, 夙闵凶."] ["臣/密/言: /臣/以/险衅/, 夙/遭/闵凶./"]
note = [] note = []
translation = "臣子李密陈言我因命运不好小时候遭遇到了不幸" translation = "臣子李密陈言: 我因命运不好, 小时候遭遇到了不幸"
keyword_note = {"险衅"="凶险祸患(这里指命运不好)", "夙"="早时这里指年幼的时候", "闵"="通'悯'指可忧患的事", "凶"="不幸指丧父"} keyword_note = {"险衅"="凶险祸患(这里指命运不好)", "夙"="早时, 这里指年幼的时候", "闵"="通'悯', 指可忧患的事", "凶"="不幸, 指丧父"}
["生孩六月, 慈父见背行年四岁, 舅母志."] ["生孩/六月/, 慈父/见背/; /行年/四岁/, 舅/夺/母志./"]
note = [] note = []
translation = "刚出生六个月我慈爱的父亲就不幸去世了。经过了四年舅父逼母亲改嫁" translation = "刚出生六个月, 我慈爱的父亲就不幸去世了。经过了四年, 舅父逼母亲改嫁"
keyword_note = {"见背"="死的委婉说法", "行年"="经历的年岁", "母志"="母亲守节之志(改嫁的委婉说法)"} keyword_note = {"见背"="死的委婉说法", "行年"="经历的年岁", "母志"="母亲守节之志(改嫁的委婉说法)"}
["祖母刘愍臣孤弱, 躬亲抚养."] ["祖母/刘/愍/臣/孤弱/, 躬亲/抚养./"]
note = [] note = []
translation = "我的祖母刘氏怜悯我从小丧父便亲自对我加以抚养" translation = "我的祖母刘氏, 怜悯我从小丧父, 便亲自对我加以抚养"
keyword_note = {"愍"="怜悯", "躬亲"="亲身"} keyword_note = {"愍"="怜悯", "躬亲"="亲身"}
["臣少多疾病, 九岁不行, 零丁孤苦, 至于成立."] ["臣/少/多/疾病/, 九岁/不行/, 零丁/孤苦/, 至于/成立./"]
note = [] note = []
translation = "臣小的时候经常生病九岁时还不会行走。孤独无靠一直到成人自立" translation = "臣小的时候经常生病, 九岁时还不会行走。孤独无靠, 一直到成人自立"
keyword_note = {"成立"="成人自立"} keyword_note = {"成立"="成人自立"}
["既伯叔, 终兄弟, 门衰祚薄, 晚有儿息."] ["既/无/伯叔/, 终/鲜/兄弟/, 门/衰/祚/薄/, 晚/有/儿息./"]
note = [] note = []
translation = "既没有叔叔伯伯又没什么兄弟门庭衰微而福分浅薄很晚才有儿子" translation = "既没有叔叔伯伯, 又没什么兄弟, 门庭衰微而福分浅薄, 很晚才有儿子"
keyword_note = {"鲜"="少这里指'无'", "祚薄"="福分浅薄", "儿息"="亲生子女"} keyword_note = {"鲜"="少, 这里指'无'", "祚薄"="福分浅薄", "儿息"="亲生子女"}
["外期功强近之亲, 内应门五尺之僮, 茕茕孑立, 形影相吊."] ["外/无/期功/强近/之亲/, 内/无/应门/五尺/之僮/, 茕茕/孑立/, 形影/相吊./"]
note = [] note = []
translation = "在外面没有比较亲近的亲戚在家里又没有照应门户的童仆。生活孤单没有依靠每天只有自己的身体和影子相互安慰" translation = "在外面没有比较亲近的亲戚, 在家里又没有照应门户的童仆。生活孤单没有依靠, 每天只有自己的身体和影子相互安慰"
keyword_note = {"期功"="指关系较近的亲属", "茕茕孑立"="孤单无依靠的样子", "吊"="安慰"} keyword_note = {"期功"="指关系较近的亲属", "茕茕孑立"="孤单无依靠的样子", "吊"="安慰"}
["而刘夙婴疾病, 常床蓐, 臣汤药, 未曾废离."] ["而/刘/夙/婴/疾病/, 常/在/床蓐/, 臣/侍/汤药/, 未曾/废离./"]
note = [] note = []
translation = "但祖母又早被疾病缠绕常年卧床不起我侍奉她吃饭喝药从来就没有停止侍奉而离开她" translation = "但祖母又早被疾病缠绕, 常年卧床不起, 我侍奉她吃饭喝药, 从来就没有停止侍奉而离开她"
keyword_note = {"婴"="被...缠绕", "蓐"="通'褥'床垫", "废"="停止服侍", "离"="离开"} keyword_note = {"婴"="被...缠绕", "蓐"="通'褥', 床垫", "废"="停止服侍", "离"="离开"}
["逮圣朝, 沐浴清化."] ["逮/奉/圣朝/, 沐浴/清化./"]
note = [] note = []
translation = "到了晋朝建立我蒙受着清明的政治教化" translation = "到了晋朝建立, 我蒙受着清明的政治教化"
keyword_note = {"逮"="及到", "奉"="承奉", "圣朝"="指当时的晋朝", "沐浴清化"="蒙受清平教化"} keyword_note = {"逮"="及, 到", "奉"="承奉", "圣朝"="指当时的晋朝", "沐浴清化"="蒙受清平教化"}
["前太守臣逵察臣孝廉;后刺史臣荣举臣秀才."] ["前/太守/臣/逵/察/臣/孝廉/; /后/刺史/臣/荣/举/臣/秀才./"]
note = [] note = []
translation = "前任太守逵考察后推举臣下为孝廉后任刺史荣又推举臣下为优秀人才" translation = "前任太守逵, 考察后推举臣下为孝廉, 后任刺史荣又推举臣下为优秀人才"
keyword_note = {"察"="考察和推举", "孝廉"="孝顺品性纯洁", "举"="推举", "秀才"="优秀人才"} keyword_note = {"察"="考察和推举", "孝廉"="孝顺, 品性纯洁", "举"="推举", "秀才"="优秀人才"}
["臣供养无主, 辞不赴命."] ["臣/以/供养/无主/, 辞/不赴命./"]
note = [] note = []
translation = "臣下因为供奉赡养祖母的事无人承担辞谢不接受任命" translation = "臣下因为供奉赡养祖母的事无人承担, 辞谢不接受任命"
keyword_note = {"无主"="无人承担"} keyword_note = {"无主"="无人承担"}
["诏书特下, 拜郎中, 寻国恩, 除洗马."] ["诏书/特下/, 拜/臣/郎中/, 寻/蒙/国恩/, 除/臣/洗马./"]
note = [] note = []
translation = "朝廷又特地下了诏书任命我为郎中不久又蒙受国家恩命任命我为太子洗马" translation = "朝廷又特地下了诏书, 任命我为郎中, 不久又蒙受国家恩命, 任命我为太子洗马"
keyword_note = {"拜"="授予官职", "郎中"="尚书省的属官", "寻"="不久", "除"="拜官受职", "洗马"="太子的属官"} keyword_note = {"拜"="授予官职", "郎中"="尚书省的属官", "寻"="不久", "除"="拜官受职", "洗马"="太子的属官"}
["猥微贱, 当东宫, 非陨首所能上报."] ["猥/以/微贱/, 当/侍/东宫/, 非/臣/陨首/所能/上报./"]
note = [] note = []
translation = "像我这样出身微贱地位卑下的人担当侍奉太子的职务这实在不是我杀身捐躯所能报答朝廷的" translation = "像我这样出身微贱地位卑下的人, 担当侍奉太子的职务, 这实在不是我杀身捐躯所能报答朝廷的"
keyword_note = {"猥"="谦词", "微贱"="卑微低贱", "东宫"="太子居处", "陨首"="杀身"} keyword_note = {"猥"="谦词", "微贱"="卑微低贱", "东宫"="太子居处", "陨首"="杀身"}
["臣具以表闻, 辞不就职."] ["臣/具/以表/闻/, 辞/不就职./"]
note = [] note = []
translation = "我将以上苦衷上表报告加以推辞不去就职" translation = "我将以上苦衷上表报告, 加以推辞不去就职"
keyword_note = {"具"="详细", "闻"="使...知道"} keyword_note = {"具"="详细", "闻"="使...知道"}
["诏书切峻, 责臣逋慢;郡县逼迫, 催臣上道;州司临门, 急于星火."] ["诏书/切峻/, 责/臣/逋慢/; /郡县/逼迫/, 催/臣/上道/; /州司/临门/, 急于/星火./"]
note = [] note = []
translation = "但是诏书急切严峻责备我逃避命令有意拖延态度傲慢。郡县长官催促我立刻上路州官登门督促比流星坠落还要急迫" translation = "但是诏书急切严峻, 责备我逃避命令, 有意拖延, 态度傲慢。郡县长官催促我立刻上路; 州官登门督促, 比流星坠落还要急迫"
keyword_note = {"切峻"="急切而严厉", "逋慢"="逃避怠慢", "星火"="流星的光喻急迫"} keyword_note = {"切峻"="急切而严厉", "逋慢"="逃避怠慢", "星火"="流星的光, 喻急迫"}
["臣奉诏奔驰, 则刘病日笃, 欲苟顺私情, 则告诉不许."] ["臣/欲/奉诏/奔驰/, 则/刘/病/日笃/, 欲/苟/顺/私情/, 则/告诉/不许./"]
note = [] note = []
translation = "我很想遵从皇上的旨意赴京就职但祖母刘氏的病却一天比一天重想要姑且顺从自己的私情但报告申诉不被允许" translation = "我很想遵从皇上的旨意赴京就职, 但祖母刘氏的病却一天比一天重; 想要姑且顺从自己的私情, 但报告申诉不被允许"
keyword_note = {"日笃"="病情日益加重", "苟"="姑且", "告诉"="报告申诉"} keyword_note = {"日笃"="病情日益加重", "苟"="姑且", "告诉"="报告申诉"}
["臣进退, 实为狼狈."] ["臣/之/进退/, 实为/狼狈./"]
note = [] note = []
translation = "我是进退两难十分狼狈" translation = "我是进退两难, 十分狼狈"
keyword_note = {"狼狈"="进退两难的样子"} keyword_note = {"狼狈"="进退两难的样子"}
["伏惟圣朝以孝治天下, 凡故老, 犹矜育, 况孤苦, 特为尤甚."] ["伏惟/圣朝/以/孝/治/天下/, 凡/在/故老/, 犹/蒙/矜育/, 况/臣/孤苦/, 特为/尤甚./"]
note = [] note = []
translation = "我俯伏思量晋朝是用孝道来治理天下的凡是年老而德高的旧臣尚且还受到怜悯养育何况我的孤苦程度更为严重呢" translation = "我俯伏思量晋朝是用孝道来治理天下的, 凡是年老而德高的旧臣, 尚且还受到怜悯养育, 何况我的孤苦程度更为严重呢"
keyword_note = {"伏惟"="下对上的敬辞", "故老"="年老德高的旧臣", "矜育"="怜悯养育"} keyword_note = {"伏惟"="下对上的敬辞", "故老"="年老德高的旧臣", "矜育"="怜悯养育"}
["且臣少仕伪朝, 历职郎署, 本图宦达, 不矜名节."] ["且/臣/少/仕/伪朝/, 历职/郎署/, 本图/宦达/, 不矜/名节./"]
note = [] note = []
translation = "况且我年轻的时候曾经做过蜀汉的官担任过郎官职务本来就希望做官显达并不顾惜名声节操" translation = "况且我年轻的时候曾经做过蜀汉的官, 担任过郎官职务, 本来就希望做官显达, 并不顾惜名声节操"
keyword_note = {"伪朝"="对前朝的蔑称", "历职"="连续任职", "郎署"="尚书郎的官衙", "宦达"="官场上显达"} keyword_note = {"伪朝"="对前朝的蔑称", "历职"="连续任职", "郎署"="尚书郎的官衙", "宦达"="官场上显达"}
["今亡国贱俘, 至微至陋, 过拔擢, 宠命优渥, 岂敢盘桓, 有所希冀!"] ["今/臣/亡国/贱俘/, 至微/至陋/, 过/蒙/拔擢/, 宠命/优渥/, 岂敢/盘桓/, 有所/希冀!/"]
note = [] note = []
translation = "现在我是一个低贱的亡国俘虏十分卑微浅陋受到过分提拔恩宠优厚怎敢犹豫不决而有非分的企求呢" translation = "现在我是一个低贱的亡国俘虏, 十分卑微浅陋, 受到过分提拔, 恩宠优厚, 怎敢犹豫不决而有非分的企求呢"
keyword_note = {"拔擢"="提拔", "优渥"="优厚", "盘桓"="徘徊不前", "希冀"="非分的企求"} keyword_note = {"拔擢"="提拔", "优渥"="优厚", "盘桓"="徘徊不前", "希冀"="非分的企求"}
["但以刘日薄西山, 气息奄奄, 人命危浅, 朝不虑夕."] ["但/以/刘/日薄/西山/, 气息/奄奄/, 人命/危浅/, 朝不/虑夕./"]
note = [] note = []
translation = "只是因为祖母刘氏寿命即将终了气息微弱生命垂危早上不能想到晚上怎样" translation = "只是因为祖母刘氏寿命即将终了, 气息微弱, 生命垂危, 早上不能想到晚上怎样"
keyword_note = {"日薄西山"="太阳接近西山喻人寿命将终", "危浅"="生命垂危"} keyword_note = {"日薄西山"="太阳接近西山, 喻人寿命将终", "危浅"="生命垂危"}
["臣祖母, 无以至今日, 祖母无臣, 无以终余年."] ["臣/无/祖母/, 无以/至今日/, 祖母/无/臣/, 无以/终余年./"]
note = [] note = []
translation = "臣下我如果没有祖母就没有今天的样子祖母如果没有我的照料也无法度过她的余生" translation = "臣下我如果没有祖母, 就没有今天的样子; 祖母如果没有我的照料, 也无法度过她的余生"
keyword_note = {"终余年"="度过余生"} keyword_note = {"终余年"="度过余生"}
["母孙二人, 更相为命, 是以区区不能废远."] ["母孙/二人/, 更相/为命/, 是以/区区/不能/废远./"]
note = [] note = []
translation = "我们祖孙二人互相依靠而维持生命因此我的内心不愿废止奉养远离祖母" translation = "我们祖孙二人, 互相依靠而维持生命, 因此我的内心不愿废止奉养, 远离祖母"
keyword_note = {"更相"="相互", "区区"="自己的私情", "废远"="废止奉养而远离"} keyword_note = {"更相"="相互", "区区"="自己的私情", "废远"="废止奉养而远离"}
["臣今年四十有四, 祖母今年九十有六, 是臣尽节于陛下之日, 报养之日短."] ["臣/密/今年/四十/有四/, 祖母/今年/九十/有六/, 是/臣/尽节/于/陛下/之日/长/, 报养/刘/之日/短./"]
note = [] note = []
translation = "臣下我现在的年龄四十四岁了祖母现在的年龄九十六岁了臣下我在陛下面前尽忠尽节的日子还长着呢而在祖母刘氏面前尽孝尽心的日子已经不多了" translation = "臣下我现在的年龄四十四岁了, 祖母现在的年龄九十六岁了, 臣下我在陛下面前尽忠尽节的日子还长着呢, 而在祖母刘氏面前尽孝尽心的日子已经不多了"
keyword_note = {"有"="又", "尽节"="尽忠节"} keyword_note = {"有"="又", "尽节"="尽忠节"}
["乌鸟私情, 愿终养."] ["乌鸟/私情/, 愿/乞/终养./"]
note = [] note = []
translation = "我怀着乌鸦反哺的私情乞求能够准许我完成对祖母养老送终的心愿" translation = "我怀着乌鸦反哺的私情, 乞求能够准许我完成对祖母养老送终的心愿"
keyword_note = {"乌鸟私情"="乌鸦反哺之情喻孝心", "终养"="养老至终"} keyword_note = {"乌鸟私情"="乌鸦反哺之情, 喻孝心", "终养"="养老至终"}
["臣辛苦, 非独蜀之人士二州牧伯所见明知, 皇天后土, 实所共鉴."] ["臣/之/辛苦/, 非独/蜀之/人士/及/二州/牧伯/所见/明知/, 皇天/后土/, 实所/共鉴./"]
note = [] note = []
translation = "我的辛酸苦楚并不仅仅被蜀地的百姓及益州、梁州的长官所亲眼目睹、内心明白连天地神明也都看得清清楚楚" translation = "我的辛酸苦楚, 并不仅仅被蜀地的百姓及益州、梁州的长官所亲眼目睹、内心明白, 连天地神明也都看得清清楚楚"
keyword_note = {"辛苦"="辛酸苦楚", "牧伯"="州郡长官", "皇天后土"="天地神明", "鉴"="明察"} keyword_note = {"辛苦"="辛酸苦楚", "牧伯"="州郡长官", "皇天后土"="天地神明", "鉴"="明察"}
["愿陛下矜悯愚诚, 听微志, 庶侥幸, 保余年."] ["愿/陛下/矜悯/愚诚/, 听/臣/微志/, 庶/刘/侥幸/, 保/卒/余年./"]
note = [] note = []
translation = "希望陛下能怜悯我愚昧诚心请允许我完成臣下一点小小的心愿使祖母刘氏能够侥幸地保全她的余生" translation = "希望陛下能怜悯我愚昧诚心, 请允许我完成臣下一点小小的心愿, 使祖母刘氏能够侥幸地保全她的余生"
keyword_note = {"矜悯"="怜悯", "听"="准许", "庶"="或许(表希望)", "卒余年"="终老"} keyword_note = {"矜悯"="怜悯", "听"="准许", "庶"="或许(表希望)", "卒余年"="终老"}
["臣生当陨首, 死结草."] ["臣/生/当/陨首/, 死/当/结草./"]
note = [] note = []
translation = "我活着应当杀身报效朝廷死了也要结草衔环来报答陛下的恩情" translation = "我活着应当杀身报效朝廷, 死了也要结草衔环来报答陛下的恩情"
keyword_note = {"陨首"="掉脑袋指献出生命", "结草"="死后报恩的典故"} keyword_note = {"陨首"="掉脑袋, 指献出生命", "结草"="死后报恩的典故"}
["臣不胜犬马怖惧之情, 谨拜表以闻."] ["臣/不胜/犬马/怖惧/之情/, 谨/拜表/以闻./"]
note = [] note = []
translation = "臣下我怀着牛马一样不胜恐惧的心情恭敬地呈上此表来使陛下知道这件事" translation = "臣下我怀着牛马一样不胜恐惧的心情, 恭敬地呈上此表来使陛下知道这件事"
keyword_note = {"不胜"="禁不住", "犬马怖惧"="臣子谦卑的自比", "闻"="使...知道"} keyword_note = {"不胜"="禁不住", "犬马怖惧"="臣子谦卑的自比", "闻"="使...知道"}

View File

@@ -133,6 +133,10 @@ class Reactor():
self.electron_file.save() self.electron_file.save()
def report(self, atom, quality): def report(self, atom, quality):
"""
0: 初次激活/通过
1: 不通过
"""
if atom in self.atoms_new: if atom in self.atoms_new:
atom[0].revisor(quality, True) atom[0].revisor(quality, True)
return 0 return 0

View File

@@ -1,5 +1,6 @@
Screen { Screen {
align: center middle; align: center bottom;
} }
#main_container { #main_container {
@@ -10,6 +11,13 @@ Screen {
padding: 2; padding: 2;
} }
#vice_container {
align: center middle;
width: 95%;
height: auto;
padding: 2;
}
#sentence { #sentence {
content-align: center middle; content-align: center middle;
width: 100%; width: 100%;