class PhilosophicalZombie(Agent): def __init__(self, verbose=True): # Static state. self.english = English() # Dynamic state. self.reset() self.verbose = verbose def reset(self): self.mind = Mind() self.self_uid = self.mind.new_user() def new_user(self): return self.mind.new_user() def put(self, from_uid, text): recog = self.english.recognize(text, verbose=self.verbose) delib = Deliberation(recog) if not delib.recognized.dsens: return delib for dsen in delib.recognized.dsens: r = self.mind.overhear(dsen, [from_uid], [self.self_uid]) # Returns None if it rejected the input dsen. if not r: continue # Else, r.out contains the output, which may be None. # if r.out: # delib.out = self.english.say(r.out) delib.out = r.text return delib # Enable this assert to require everything to be understood by the # system, including funky parses. Useful for development. # assert delib.out is not None return delib
def reset(self): self.mind = Mind() self.self_uid = self.mind.new_user()