[fix] sets of potential languages in case phrase matches multiple dictionaries
This commit is contained in:
@@ -103,8 +103,8 @@ def disambiguate_language(text, languages):
|
|||||||
if c is PHRASE:
|
if c is PHRASE:
|
||||||
valid = OrderedDict()
|
valid = OrderedDict()
|
||||||
data = [safe_decode(d).split(u'|') for d in data]
|
data = [safe_decode(d).split(u'|') for d in data]
|
||||||
potentials = [l for l, d, i, c in data if l in valid_languages]
|
potentials = set([l for l, d, i, c in data if l in valid_languages])
|
||||||
potential_defaults = [l for l in potentials if valid_languages[l]]
|
potential_defaults = set([l for l in potentials if valid_languages[l]])
|
||||||
|
|
||||||
phrase_len = sum((len(t_i[0]) for t_i in t))
|
phrase_len = sum((len(t_i[0]) for t_i in t))
|
||||||
for lang, dictionary, is_canonical, canonical in data:
|
for lang, dictionary, is_canonical, canonical in data:
|
||||||
|
|||||||
Reference in New Issue
Block a user