Are there missing libraries in nltk.sem?

0

I wanted to design patterns that are sensitive to Part-Of-Speech (POS) tags from the Dutch section of CoNLL 2002 Named Entity Corpus which then does not contain only the entity annotation named. However, the method% co_of% who is supposed to print the relationships in a clausal form, where the binary relationship symbol is specified as the value of the relsym parameter, does not seem to be part of show_clause() . However, it seemed to have been used successfully in Natural Language Processing with Python .

>>> for doc in conll2002.chunked_sents('ned.train'):
...     for r in nltk.sem.extract_rels('PER', 'ORG', doc,corpus='conll2002', pattern=VAN):
...         print nltk.sem.show_clause(r, relsym="VAN")
... 
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
AttributeError: 'module' object has no attribute 'show_clause'

It's the same for nltk.sem

    
asked by ThePassenger 23.07.2018 в 15:10
source

1 answer

0

The example you sample is for version 2 of NLTK but you use NLTK 3.x. Both functions were renamed in version 3 of NLTK:

  • show_raw_rtuple() - > rtuple()
  • show_clause() - > clause()

These functions are defined in the module nltk.sem.relextract by if you want to see the documentation, although they can be accessed using nltk.sem.clause and nltk.sem.rtuple thanks to the fact that they are exposed in the package using __init__.py .

    
answered by 23.07.2018 / 17:12
source