openeventdata / UniversalPetrarch

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

Verb phrase finder doesn't look for prepositions or direct objects #26

Open ahalterman opened 6 years ago

ahalterman commented 6 years ago

In looking for parts of the verb phrase, UniversalPetrarch only looks for negations, compounds, and adverbial clause modifiers. It doesn't look for prepositions ("fired AT targets") or direct objects ("chanted SLOGANS). (code) Prepositions and direct objects are major parts of verb patterns (indeed, they're specially marked in the dictionaries to make matching possible). This lack of code rules out using any verb dictionary entries that include any direct objects or prepositions and would explain why the Petr2 dictionaries were working so badly.

JingL1014 commented 6 years ago

In current coder, the way to handle prepositional phrase is a little bit different from PETR2 implementation. As mentioned in #27, in step 1, the action in the "fired AT targets" is extracted as "fired at", and prepositions are handled inside verb phrase (code)

ahalterman commented 6 years ago

Looking at the code, that seems to handle the comparison between the extracted verb phrase and the dictionaries. What I'm concerned about is the ability of UniversalPetrarch to extract preps and dobjs in the verb phrase from the text to begin with. If it can't extract them correctly, then it won't have any of them to compare against the dictionary in that code chunk. Am I missing something?

ahalterman commented 5 years ago

Just checking in on this again, especially since the preposition issue came up in Arabic. Is the code indeed extracting prepositional phrases coming off the verb? And am I right in thinking that that code concerns pattern matching, not phrase extraction?

JingL1014 commented 5 years ago

Yes. Now the coder concerns the prepositions coming off the verb to do the pattern matching. It matches the entire verb phrases (the verb and a sequence of other chunks such as a noun phrase or a prepositional phrase that follow the verb)

ahalterman commented 5 years ago

Great! Can you link to the part of the code that implements it, just so I can make sure I understand where it's doing it?

Edit: The original implementation is linked here: #28

JingL1014 commented 5 years ago

The code can be found in function match_lower() starting from line 1660 to line 1700