nltk/nltk — Issue #97: nltk.sem.relextract.ne_chunked() error, needs update
Author: alexrudnick
Created: 2012-01-17 06:26:01+00:00
State: open

What version of NLTK are you using? (See nltk.__version__). Please only
submit bug reports for the current version.

2.0b7

What steps will reproduce the problem? (e.g. include Python source code)
import nltk
nltk.sem.relextract.ne_chunked()

Produces no output.

What is the expected output? What do you see instead?

I expect to see the relationships printed. Instead I just see "[]" 100 times.

Please use labels and text to provide additional information.
Line 461 in nltk/sem/relextract.py is:
print extract_rels('ORG', 'LOC', sent, corpus='ace', pattern = IN)

However, the documentation for extract_rels reads
"The parameters C{subjclass} and C{objclass} can be used to restrict the
Named Entities to particular types (any of 'LOCATION', 'ORGANIZATION',
'PERSON', 'DURATION', 'DATE', 'CARDINAL', 'PERCENT', 'MONEY',
'MEASURE')."

So this line should be:
print extract_rels('ORGANIZATION', 'LOCATION', sent, corpus='ace',
pattern = IN)

However, even after fixing the line it still just prints 100 "[]" lines.

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

earlier comments

StevenBird1 said, at 2010-02-03T10:19:10.000Z:

Referring this to Ewan for review