fhamborg / Giveme5W1H

Extraction of the journalistic five W and one H questions (5W1H) from news articles: who did what, when, where, why, and how?
Apache License 2.0
505 stars 87 forks source link

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

Open nurub-tech opened 3 years ago

nurub-tech commented 3 years ago

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):

imohitmayank commented 3 years ago

Facing the same issue on Ubuntu 18.04 and Python 3.6.9

TitasDas commented 3 years ago

Try the solution in #43 by installing jdk 8.