Created
May 13, 2014 18:55
-
-
Save mdamien/9bc4553e4d293aa73014 to your computer and use it in GitHub Desktop.
Basic dictionnary with WordNet
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
defs = {} | |
for i, line in enumerate(open('data.noun')): | |
if not line.startswith('0'): | |
continue | |
splits = line.split(' ') | |
word = splits[4] | |
seps = line.split('|') | |
bla = seps[1].split(';') | |
definition = bla[0] | |
wdefs = defs.get(word,[]) | |
wdefs.append(definition) | |
defs[word] = wdefs | |
s = ' ' | |
while s != '': | |
s = input('Word:') | |
for d in defs.get(s,[]): | |
print(d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment