class NaiveLangDetector(BaseDetector): def __init__(self): self.lid = Lid() def language(self, query): if query.startswith('www') or query.startswith('http'): raise NotImplementedError('For URL It does not work yet.') else: result = self.lid.checkText(query) dict_result = {'language': result['language']} return {'response': {'languages': [dict_result], 'text': query}}
def __init__(self): self.lid = Lid()