@@ -47,8 +47,6 @@ def __init__(self, args):
4747 self .transport .subscribe (self .solve_destination , self .callback )
4848 self .transport .subscribe (self .speech_address , self .speech_callback )
4949 self .transport .subscribe (self .text_address , self .text_callback )
50- print (self .speech_address )
51- print (self .address )
5250
5351
5452 def setup_ui_parser (self ):
@@ -110,8 +108,8 @@ def process_input(self, msg):
110108 self .specializer .set_spans (matched )
111109 ntuple = self .specializer .specialize (fs )
112110
113- json_ntuple = self .decoder .convert_to_JSON (ntuple )
114- return json_ntuple
111+ # json_ntuple = self.decoder.convert_to_JSON(ntuple)
112+ return ntuple
115113 except Exception as e :
116114 self .output_stream (self .name , e )
117115 #traceback.print_exc()
@@ -126,20 +124,17 @@ def output_stream(self, tag, message):
126124 def speech_callback (self , ntuple ):
127125 """ Processes text from a SpeechAgent. """
128126 #print(ntuple)
129- print (ntuple )
130127 #ntuple = json.loads(ntuple)
131- print (ntuple ['text' ])
132- json_ntuple = self .process_input (ntuple ['text' ])
133-
134- if json_ntuple and json_ntuple != "null" and "predicate_type" in json .loads (json_ntuple ):
135- self .transport .send (self .solve_destination , json_ntuple )
128+ new_ntuple = self .process_input (ntuple ['text' ])
129+ if new_ntuple and new_ntuple != "null" and "predicate_type" in new_ntuple :
130+ self .transport .send (self .solve_destination , new_ntuple )
136131
137132
138133 def text_callback (self , ntuple ):
139134 """ Processes text from a SpeechAgent. """
140135 #print(ntuple)
141136 specialize = True
142- ntuple = json .loads (ntuple )
137+ # ntuple = json.loads(ntuple)
143138 msg = ntuple ['text' ]
144139 if ntuple ['type' ] == "standard" :
145140 if msg == None or msg == "" :
@@ -148,19 +143,14 @@ def text_callback(self, ntuple):
148143 self .specializer .set_debug ()
149144 specialize = False
150145 elif specialize :
151- json_ntuple = self .process_input (ntuple ['text' ])
152- if json_ntuple and json_ntuple != "null" and "predicate_type" in json . loads ( json_ntuple ) :
153- self .transport .send (self .solve_destination , json_ntuple )
146+ new_ntuple = self .process_input (ntuple ['text' ])
147+ if new_ntuple and new_ntuple != "null" and "predicate_type" in new_ntuple :
148+ self .transport .send (self .solve_destination , new_ntuple )
154149 elif ntuple ['type' ] == "clarification" :
155- first = self .process_input (msg )
156- descriptor = json .loads (first )
157- #print(descriptor)
158- converted = json .loads (ntuple ['original' ])
150+ descriptor = self .process_input (msg )
159151 self .clarification = False
160- new_ntuple = self .clarify_ntuple (converted , descriptor )
161- json_ntuple = self .decoder .convert_to_JSON (new_ntuple )
162- #json_ntuple = json.dumps(new_ntuple)
163- self .transport .send (self .solve_destination , json_ntuple )
152+ new_ntuple = self .clarify_ntuple (ntuple ['original' ], descriptor )
153+ self .transport .send (self .solve_destination , new_ntuple )
164154 self .clarification = False
165155
166156
@@ -206,17 +196,17 @@ def prompt(self):
206196 specialize = False
207197 elif specialize :
208198 #if self.check_spelling(msg):
209- json_ntuple = self .process_input (msg )
210- if json_ntuple and json_ntuple != "null" and "predicate_type" in json . loads ( json_ntuple ) :
211- self .transport .send (self .solve_destination , json_ntuple )
199+ ntuple = self .process_input (msg )
200+ if ntuple and ntuple != None and "predicate_type" in ntuple :
201+ self .transport .send (self .solve_destination , ntuple )
212202
213203
214204
215205 def process_clarification (self , tag , msg , ntuple ):
216206 self .clarification = True
217207 #self.output_stream(tag, msg)
218- json_ntuple = json . dumps ( {'tag' : tag , 'message' : msg , 'type' : "clarification" , 'original' : ntuple })
219- self .transport .send (self .text_address , json_ntuple )
208+ new_ntuple = {'tag' : tag , 'message' : msg , 'type' : "clarification" , 'original' : ntuple }
209+ self .transport .send (self .text_address , new_ntuple )
220210 """
221211 #print(ntuple)
222212 while True:
0 commit comments