From 7d0991f9c1b1379c669c0da9f1f678285dd0c968 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Tue, 12 Apr 2016 20:48:11 -0700 Subject: Updating compiler --- util/compile.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/util/compile.py b/util/compile.py index 7510aa9b..b41fdf6d 100755 --- a/util/compile.py +++ b/util/compile.py @@ -144,15 +144,14 @@ def load_definitions(path): def parse_kanji_dic(path): - results = [] - + results = {} for line in load_definitions(path): segments = line.split() character = segments[0] - kunyomi = ', '.join(filter(lambda x: filter(is_hiragana, x), segments[1:])) - onyomi = ', '.join(filter(lambda x: filter(is_katakana, x), segments[1:])) + kunyomi = ' '.join(filter(lambda x: list(filter(is_hiragana, x)), segments[1:])) + onyomi = ' '.join(filter(lambda x: list(filter(is_katakana, x)), segments[1:])) glossary = '; '.join(re.findall('\{([^\}]+)\}', line)) - results.append((character, kunyomi, onyomi, glossary)) + results[character] = (kunyomi or None, onyomi or None, glossary) return results -- cgit v1.2.3