Updating dictionary format
This commit is contained in:
parent
fbb7635594
commit
6f256ec25a
@ -137,7 +137,7 @@ def parse_krad_file(path):
|
|||||||
|
|
||||||
|
|
||||||
def parse_edict(path):
|
def parse_edict(path):
|
||||||
results = []
|
results = {}
|
||||||
|
|
||||||
for line in load_definitions(path):
|
for line in load_definitions(path):
|
||||||
segments = line.split('/')
|
segments = line.split('/')
|
||||||
@ -154,11 +154,11 @@ def parse_edict(path):
|
|||||||
tags = []
|
tags = []
|
||||||
for group in re.findall('\(([^\)\]]+)\)', glossary):
|
for group in re.findall('\(([^\)\]]+)\)', glossary):
|
||||||
tags.extend(group.split(','))
|
tags.extend(group.split(','))
|
||||||
|
tags = list(set(tags).intersection(PARSED_TAGS))
|
||||||
|
|
||||||
tags = set(tags).intersection(PARSED_TAGS)
|
defs = results.get(term, [])
|
||||||
tags = ' '.join(sorted(tags))
|
defs.append((reading, glossary, tags))
|
||||||
|
results[term] = defs
|
||||||
results.append((term, reading, glossary, tags))
|
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user