1

Display Kanji results in order that they are encountered

Former-commit-id: 5324fcfae066149171584f484da64c3ea2c63584
This commit is contained in:
Alex Yatskov 2013-11-15 19:53:05 -08:00
parent ddfba5a1ca
commit c40f778955

View File

@ -51,12 +51,17 @@ class Translator:
def findCharacters(self, text): def findCharacters(self, text):
results = dict() results = list()
for c in text:
if c not in results:
results[c] = self.dictionary.findCharacter(c)
return filter(operator.truth, results.values()) processed = dict()
for c in text:
if c not in processed:
match = self.dictionary.findCharacter(c)
if match is not None:
results.append(match)
processed[c] = match
return results
def processTerm(self, groups, source, rules=list(), root=str(), partial=False): def processTerm(self, groups, source, rules=list(), root=str(), partial=False):