增加再学习机制和状态反馈
This commit is contained in:
@@ -29,6 +29,7 @@ class Composition:
|
||||
screen: Screen,
|
||||
reactor,
|
||||
atom: Tuple[pt.Electron, pt.Nucleon, Dict] = pt.Atom.placeholder(),
|
||||
extra = {}
|
||||
):
|
||||
self.screen = screen
|
||||
self.atom = atom
|
||||
@@ -58,7 +59,7 @@ class Composition:
|
||||
|
||||
|
||||
class Finished(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], extra = {}):
|
||||
super().__init__(screen, reactor, atom)
|
||||
|
||||
def compose(self):
|
||||
@@ -66,7 +67,7 @@ class Finished(Composition):
|
||||
|
||||
|
||||
class Placeholder(Composition):
|
||||
def __init__(self, screen: Screen):
|
||||
def __init__(self, screen: Screen, extra = {}):
|
||||
self.screen = screen
|
||||
|
||||
def compose(self):
|
||||
@@ -78,7 +79,7 @@ class Placeholder(Composition):
|
||||
|
||||
|
||||
class Recognition(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], extra = {}):
|
||||
super().__init__(screen, reactor, atom)
|
||||
|
||||
def compose(self):
|
||||
@@ -130,7 +131,7 @@ class Recognition(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], extra = {}):
|
||||
super().__init__(screen, reactor, atom)
|
||||
|
||||
def compose(self):
|
||||
@@ -167,8 +168,9 @@ class BasicEvaluation(Composition):
|
||||
|
||||
|
||||
class FillBlank(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], extra:Dict = {}):
|
||||
super().__init__(screen, reactor, atom)
|
||||
self.extra = extra
|
||||
self.inputlist = []
|
||||
self.hashtable = {}
|
||||
self._work()
|
||||
@@ -180,6 +182,8 @@ class FillBlank(Composition):
|
||||
random.shuffle(self.ans)
|
||||
|
||||
def compose(self):
|
||||
if self.extra.get("feedback_msg"):
|
||||
yield Label("反馈提示:" + self.extra["feedback_msg"])
|
||||
yield Label(self.puzzle.wording, id=self.regid("sentence"))
|
||||
yield Label(f"当前输入: {self.inputlist}", id=self.regid("inputpreview"))
|
||||
for i in self.ans:
|
||||
@@ -206,11 +210,11 @@ class FillBlank(Composition):
|
||||
else:
|
||||
self.inputlist = []
|
||||
self.reactor.report(self.atom, 2)
|
||||
return 1
|
||||
return 2
|
||||
|
||||
|
||||
class DrawCard(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], extra = {}):
|
||||
super().__init__(screen, reactor, atom)
|
||||
self.inputlist = []
|
||||
self.hashtable = {}
|
||||
@@ -247,7 +251,7 @@ class DrawCard(Composition):
|
||||
else:
|
||||
self.inputlist = []
|
||||
self.reactor.report(self.atom, 2)
|
||||
return 1
|
||||
return 2
|
||||
|
||||
|
||||
registry = {
|
||||
|
Reference in New Issue
Block a user