def get(self): in_text = self.get_argument('q') in_mode = toAlpha3Code(self.get_argument('lang')) if in_mode in self.analyzers: [path, mode] = self.analyzers[in_mode] formatting = 'txt' commands = [['apertium', '-d', path, '-f', formatting, mode]] result = yield translation.translateSimple(in_text, commands) self.sendResponse(self.postproc_text(in_text, result)) else: self.send_error(400, explanation='That mode is not installed')
def get(self): in_text = self.get_argument('q') in_mode = toAlpha3Code(self.get_argument('lang')) if in_mode in self.generators: [path, mode] = self.generators[in_mode] formatting = 'none' commands = [['apertium', '-d', path, '-f', formatting, mode]] lexical_units, to_generate = self.preproc_text(in_text) result = yield translation.translateSimple(to_generate, commands) self.sendResponse(self.postproc_text(lexical_units, result)) else: self.send_error(400, explanation='That mode is not installed')