Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gabor Recski
committed
May 30, 2017
1 parent
9aeed0c
commit f4a6aea
Showing
4 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,8 +1,16 @@ | |||
import json | import json | ||
import sys | import sys | ||
import traceback | |||
|
|
||
data = json.load(sys.stdin) | data = json.load(sys.stdin) | ||
for e in data.itervalues(): | for e in data.itervalues(): | ||
if e['senses'] and e['senses'][0]['definition']: | if not e['senses']: | ||
print u"{0}\t{1}".format( | continue | ||
e['hw'], e['senses'][0]['definition']['sen']).encode('utf-8') | 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters