You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
430 B
18 lines
430 B
6 years ago
|
class Language(object):
|
||
|
'''
|
||
|
Language is to store the detected language.
|
||
|
Detector.get_probabilities() returns a list of Languages.
|
||
|
'''
|
||
|
|
||
|
def __init__(self, lang, prob):
|
||
|
self.lang = lang
|
||
|
self.prob = prob
|
||
|
|
||
|
def __repr__(self):
|
||
|
if self.lang is None:
|
||
|
return ''
|
||
|
return '%s:%s' % (self.lang, self.prob)
|
||
|
|
||
|
def __lt__(self, other):
|
||
|
return self.prob < other.prob
|