Reputation: 559
What are the packages required to run the below commands?
import nltk
from nltk.corpus import wordnet
v = 'go'
present = present_tense(v)
I got an error saying-
NameError: name 'present_tense' is not defined
Upvotes: 0
Views: 5481
Reputation: 31
You may try: import en
instead of: import nltk
You may try: en.verb.present(v)
instead of: present_tense(v)
The en package is from the NodeBox English Linguistics library
Demo site: http://wnbot.com/wordnet/stackoverflow.py
Draft source code listing:
#!/usr/bin/python
import en
import sys
went = 'went'
going = 'going'
gone = 'gone'
goes = 'goes'
print "Content-Type: text/html"
print
print "<html><head><title>Stack Overflow answer</title></head><body>"
print ' The present tense of <b>',going, '</b> is <i>',en.verb.present(going),'</i><br>'
print ' The present tense of <b>',goes, '</b> is <i>',en.verb.present(goes),'</i><br>'
print ' The present tense of <b>',gone, '</b> is <i>',en.verb.present(gone),'</i><br>'
print ' The present tense of <b>',went, '</b> is <i>',en.verb.present(went),'</i><br>'
print "</body></html>"
This source code listing is a draft for educational and discussion purposes only.
Upvotes: 3