nltk/nltk — Issue #44: doctests
Author: alexrudnick
Created: 2012-01-17 06:24:43+00:00
State: open

Lots of doctests are still broken, and need joint effort to repair...

http://nltk.googlecode.com/svn/trunk/doc/howto/index.html
http://buildbot.nltk.org/

Migrated from http://code.google.com/p/nltk/issues/detail?id=212

earlier comments

StevenBird1 said, at 2009-02-02T01:11:39.000Z:

I've fixed up a bunch of the doctests and updated the site:

http://nltk.googlecode.com/svn/trunk/doc/howto/index.html

The semantics-related packages still have a lot of errors which would be good to fix
in time for the 0.9.8 release.

DHGarrette said, at 2009-02-02T02:54:27.000Z:

I updated and ran all of the semantics doctests. No errors were found. Do you have
the required 3rd party tools (Prover9, Mace4, MaltParser) installed?

StevenBird1 said, at 2009-02-09T09:23:16.000Z:

Thanks for confirming that there's no errors in the doctests, just in my config. Its
a pity that these third party tools lack conventional installers. I plan to document
the installation process a bit more. One source of confusion is the name of the
PROVER9HOME environment variable -- sounds like the name of the root of a directory
tree rather than the binary itself. Any objections if I change this to just PROVER9?

StevenBird1 said, at 2009-02-09T09:31:57.000Z:

Also, any objections to MALTPARSERHOME -> MALTPARSER ?

StevenBird1 said, at 2009-02-09T11:20:04.000Z:

Now that the Prover9 binary can be found, Python doesn't like it. Perhaps I got the
wrong one. Which distribution should users install: the one that includes the GUI,
or the commandline version?

File "/Users/sb/Documents/workspace/nltk/trunk/nltk/nltk/test/nonmonotonic.doctest",
line 135, in ../../nltk/test/nonmonotonic.doctest
Failed example:
unp.prove()
Exception raised:
Traceback (most recent call last):
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/doctest.py",
line 1212, in __run
compileflags, 1) in test.globs
File "", line 1, in
File "/Users/sb/Documents/workspace/nltk/trunk/nltk/nltk/inference/api.py",
line 398, in prove
self.assumptions(),
File
"/Users/sb/Documents/workspace/nltk/trunk/nltk/nltk/inference/nonmonotonic.py", line
108, in assumptions
if get_prover(newEqEx, assumptions).prove():
File "/Users/sb/Documents/workspace/nltk/trunk/nltk/nltk/inference/api.py",
line 263, in prove
verbose)
File "/Users/sb/Documents/workspace/nltk/trunk/nltk/nltk/inference/prover9.py",
line 238, in prove
verbose=verbose)
File "/Users/sb/Documents/workspace/nltk/trunk/nltk/nltk/inference/prover9.py",
line 260, in _call_prover9
return self._call(input_str, self._prover9_bin, args, verbose)
File "/Users/sb/Documents/workspace/nltk/trunk/nltk/nltk/inference/prover9.py",
line 193, in _call
stdin=subprocess.PIPE)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py",
line 593, in __init__
errread, errwrite)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py",
line 1079, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error

DHGarrette said, at 2009-02-09T13:16:04.000Z:

PROVER9HOME and MALTPARSERHOME should point to the binary directories:

export PROVER9HOME="/usr/local/bin/LADR-2008-11A/bin/"
export MALTPARSERHOME="/usr/local/bin/malt-1.2/"

I have no problem with the environment variables being renamed.

I use the command line version of Prover9. I haven't tried the nltk code with the
gui version.

StevenBird1 said, at 2009-02-10T09:58:59.000Z:

I've changed the prover9 download links to the command-line version and added some
brief installation instructions here: http://www.nltk.org/download Feedback welcome.

StevenBird1 said, at 2009-02-11T12:28:14.000Z:

Still some issues with the semantics doctests, but went ahead with 0.9.8b1 release
anyway. I hope to have this all fixed in time for 0.9.8.

StevenBird1 said, at 2009-07-07T07:29:53.000Z:

I've fixed several more doctest problems, but many test still fail, incl:

chat80: 4 errors (some stale API issues?)
featgram: 7 errors (inconsistent feature uppercasing in sample grammars)
corpus: 2 errors (see issue 407)
inference: too slow at line 547: ppbc.prove()

ewan.klein said, at 2009-07-11T21:42:14.000Z:

the chat80 and featgram doctests now pass.
I'm getting this error with relextract, which seems to be a bug in the conll corpus
reader -- possibly a Unicode issue?

File "/Users/ewan/svn/nltktrunk/nltk/nltk/test/relextract.doctest", line 255, in
relextract.doctest
Failed example:
for doc in conll2002.chunked_sents('ned.train'):
for r in relextract.extract_rels('PER', 'ORG', doc, corpus='conll2002',
pattern=VAN):
print relextract.show_clause(r, relsym="VAN")
Exception raised:
Traceback (most recent call last):
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/doctest.py",
line 1212, in __run
compileflags, 1) in test.globs
File "", line 1, in
for doc in conll2002.chunked_sents('ned.train'):
File "/Users/ewan/svn/nltktrunk/nltk/nltk/util.py", line 844, in iterate_from
for value in self._lists[0].iterate_from(index):
File "nltk/corpus/reader/util.py", line 288, in iterate_from
File "nltk/corpus/reader/conll.py", line 193, in _read_grid_block
ValueError: Inconsistent number of columns:
U Pron O
mag V O
Ã©Ã©n V O
keer N O
raden V O
wie Pron O
hem Pron O
dÃ t V O
idee N O
heeft V O
ingefluisterd V O
. Punc O

StevenBird1 said, at 2009-09-19T03:03:37.000Z:

There's an issue with classify.doctest:

[Found megam: /usr/local/bin/megam]
test[0] test[1] test[2] test[3]
p(x) p(y) p(x) p(y) p(x) p(y) p(x) p(y)
-----------------------------------------------------------------------
LBFGSB Error:
GIS 0.16 0.84 0.46 0.54 0.41 0.59 0.76 0.24
IIS 0.16 0.84 0.46 0.54 0.41 0.59 0.76 0.24
Nelder-Mead Error:
CG Error:
BFGS Error:
MEGAM 0.16 0.84 0.46 0.54 0.41 0.59 0.76 0.24
TADM Error:
Powell Error: