def handleGeneration(generated): if generated is None: self.send_error(408, explanation='Request timed out') else: generated = removeLast(toGenerate, generated) self.sendResponse([(generation, lexicalUnits[index]) for (index, generation) in enumerate(generated.split('[SEP]'))])
def handleAnalysis(analysis): if analysis is None: self.send_error(408, explanation='Request timed out') else: lexicalUnits = removeLast(toAnalyze, re.findall(r'\^([^\$]*)\$([^\^]*)', analysis)) self.sendResponse([(lexicalUnit[0], lexicalUnit[0].split('/')[0] + lexicalUnit[1]) for lexicalUnit in lexicalUnits])