0

以下のコマンドを実行するために必要なパッケージは何ですか?

コード

import nltk
from nltk.corpus import wordnet
v = 'go'
present = present_tense(v)
I got an error saying-

エラーメッセージ

NameError: 名前 'present_tense' が定義されていません

4

1 に答える 1

3

import en
次の代わりに: を 試すことができます:import nltk

en.verb.present(v) 次の代わりに: を 試すことができます:present_tense(v)

en パッケージは、NodeBox English Linguistics ライブラリからのものです。

デモサイト: http://wnbot.com/wordnet/stackoverflow.py

ドラフト ソース コード リスト:

#!/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>"

このソース コード リストは、教育およびディスカッションのみを目的としたドラフトです。

于 2013-05-16T20:13:00.633 に答える