Permalink
Please sign in to comment.
Showing
with
30 additions
and 6 deletions.
- +11 −3 scripts/get_defs.py
- +2 −1 scripts/get_graph.py
- +5 −1 src/fourlang/corenlp_wrapper.py
- +12 −1 src/fourlang/wiktionary_parser.py
@@ -1,8 +1,16 @@ | |||
import json | |||
import sys | |||
import traceback | |||
|
|||
data = json.load(sys.stdin) | |||
for e in data.itervalues(): | |||
if e['senses'] and e['senses'][0]['definition']: | |||
print u"{0}\t{1}".format( | |||
e['hw'], e['senses'][0]['definition']['sen']).encode('utf-8') | |||
if not e['senses']: | |||
continue | |||
defs = [sense.get('definition') for sense in e['senses']] | |||
for definition in defs: | |||
if not definition: | |||
sys.stderr.write(e['hw'].encode('utf-8')+'\n') | |||
continue | |||
if isinstance(definition, unicode): | |||
continue | |||
print u"{0}\t{1}".format(e['hw'], definition['sen']).encode('utf-8') |
0 comments on commit
f4a6aea