Skip to content

Getting AttributeError: 'list' object has no attribute 'values' at doc_coref.values() #62

Open
@nurub-tech

Description

@nurub-tech

Describe the bug
Running the same code in the example parse_single_from_code.py and got this errors output
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Users\nurub\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\Giveme5W1H\extractor\extractor.py", line 20, in run
extractor.process(document)
File "C:\Users\nurub\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\Giveme5W1H\extractor\extractors\abs_extractor.py", line 41, in process
self._evaluate_candidates(document)
File "C:\Users\nurub\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\Giveme5W1H\extractor\extractors\action_extractor.py", line 108, in _evaluate_candidates
if any(doc_coref.values()):
AttributeError: 'list' object has no attribute 'values'

I opened action_extractor.py and added a these 3 prints before the 1st if in function _evaluate_candidates, to see its content
print( 'doc_len = ', doc_len, '\n' )
print( 'doc_ner = ', doc_ner, '\n' )
print( 'doc_coref = ', doc_coref, '\n' )

The result is
doc_len = 0
doc_ner = []
doc_coref = []

It shows that doc_coref is an array and not a dictionary and hence it doesn't have an attribute .values()

To Reproduce
Run the example on windows 10

Expected behavior
document.get_corefs() returns an array and not a dictionary

Versions (please complete the following information):

  • OS: Windows 10
  • Python 3.9
  • Giveme5W1H Version [e.g. 1.2]
  • Stanford CoreNLP Version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions