NLTK example for extracting links Does not work

I got parts of parts of the nltk book before this section on relationship extraction. Can someone help me understand why the code below is not working? There seems to be no show_raw_rtuple () method

IN = re.compile(r'.*\bin\b(?!\b.+ing)') for doc in nltk.corpus.ieer.parsed_docs('NYT_19980315'): for rel in nltk.sem.extract_rels('ORG', 'LOC', doc, corpus='ieer', pattern = IN): print nltk.sem.show_raw_rtuple(rel) 
0
source share
1 answer

It depends on your version of NLTK. On NLTK 2.x, this should work:

  print nltk.sem.relextract.show_raw_rtuple(rel) 

In NLTK 3.x, show_raw_rtuple () seems to have been replaced by rtuple ():

  print(nltk.sem.relextract.rtuple(rel)) 
+5
source

All Articles