openeventdata / UniversalPetrarch

Language-agnostic political event coding using universal dependencies
MIT License
18 stars 9 forks source link

Verb Dictionary Traversal Resulting in Null Codes #13

Closed efaurie closed 6 years ago

efaurie commented 6 years ago

I can't seem to get event codes to properly output with my own input text (English) or the English GigaWord test files. It will output event triples but the verb code is always a null code ('---') or None.

I believe this is due to an improper traversal of the Verb Dictionary while resolving a verb to its code.

Lines 1265-1266 and Line 1583 in PETRgraph.py treat the final traversal (IE: tempverbDictPath['#']['#'] in the case of 1265) as a dictionary when, in fact, it's a list of dictionaries. Which would imply that the lines should be something like the below instead.

code = tempverbDictPath['#']['#'][0]['code']
meaning = tempverbDictPath['#']['#'][0]['meaning']

I have had to make a few modifications to get the code running at all (under both Python 2.7 and Python 3.6), so I don't want to submit a PR until I know it's not due to a bug I introduced.

Have others come across this? Has everyone else needed to make modifications to get the code running or has it worked out of the box?

ahalterman commented 6 years ago

This issue has come up a few times before, but sometimes the code does generate events 🤔. A PR fixing this and adding Python 3 compatibility would be very welcome! @JingL1014, does your latest commit fix this issue?

JingL1014 commented 6 years ago

Yes. The latest commit fixed this issue. But it only works under Python 2.7.

efaurie commented 6 years ago

Closing this issue as the Verb Dictionary traversal is fixed with JingL1014's commit.