2

I downloaded the package http://nodebox.net/code/index.php/Linguistics#verb_conjugation I'm getting an error even when I tried to get a tense of a verb .

import en
print en.is_verb('use')
#prints TRUE

print en.verb.tense('use')

KeyError                                  Traceback (most recent call last)

/home/cse/version2_tense.py in <module>()
----> 1 
      2 
      3 
      4 
      5 

/home/cse/en/__init__.pyc in tense(self, word)
    124 
    125     def tense(self, word):
--> 126         return verb_lib.verb_tense(word)
    127 
    128     def is_tense(self, word, tense, negated=False):

/home/cse/en/verb/__init__.pyc in verb_tense(v)
    175 
    176     infinitive = verb_infinitive(v)
--> 177     a = verb_tenses[infinitive]
    178     for tense in verb_tenses_keys:
    179         if a[verb_tenses_keys[tense]] == v:

KeyError: ''
jscs
  • 63,694
  • 13
  • 151
  • 195
Ambika
  • 335
  • 2
  • 3
  • 8

1 Answers1

5

The reason you are getting this error is because there is a mistake in the ~/Library/Application Support/NodeBox/en/verb/verb.txt file they are using to create the dictionary.

use is the infinitive form, however, "used" is entered as the infinitive.

at line 5857:

used,,,uses,,using,,,,,used,used,,,,,,,,,,,,

should be:

use,,,uses,,using,,,,,used,used,,,,,,,,,,,,

after editing and saving the file:

import en

print en.is_verb("use")
print en.verb.infinitive('use')
print en.verb.tense('use')

gives:

True
use
infinitive

extra:

import en

print 'use    %s' % en.verb.tense("use")
print 'uses   %s' % en.verb.tense("uses")
print 'using  %s' % en.verb.tense('using')
print 'used   %s' % en.verb.tense('used')

use    infinitive
uses   3rd singular present
using  present participle
used   past
dting
  • 38,604
  • 10
  • 95
  • 114