Skip to content

Instantly share code, notes, and snippets.

@mdamien
Created May 13, 2014 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdamien/9bc4553e4d293aa73014 to your computer and use it in GitHub Desktop.
Save mdamien/9bc4553e4d293aa73014 to your computer and use it in GitHub Desktop.
Basic dictionnary with WordNet
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