Example #1
0
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}}
Example #2
0
 def __init__(self):
     self.lid = Lid()