framematcher¶
Match VerbnetFrameOccurrence to appropriate VerbNetOfficialFrame structure
Based on the 2004 Swier & Stevenson paper: Unsupervised Semantic Role Labeling.
The way frame matching works in Swier&Stevenson 2004 paper is not completely specified: what happens when VerbNet frame is longer than FrameNet’s frame?
Currently, we don’t extract any slot when a non-match appears: while it can make sense to omit objects at the end, it doesn’t to omit at the beginning and take at the end: this could result in a totally different syntactic construction. But I could be wrong!
For example, if you have in FrameNet “NP V with NP”, and VerbNet contains “NP V NP with NP”, what do you do? We decided, for now, to only match the syntactic subject.
- class framematcher.FrameMatcher(frame_occurrence, algo)[source]¶
Bases: builtins.object
Handle frame matching for a given frame that we want to annotate.
Variables: - frame_occurrence – VerbnetFrameOccurrence – The frame to annotate
- best_score – int – The best score encountered among all the matches
- best_data – (VerbnetOfficialFrame, int List) List – The frames that achieved this best score + the mapping between the slots of :frame_occurrence and these verbnet frames
- algo – str – The algorithm that we want to use
- static _is_a_match(frame_occurrence_elem, frame_elem)[source]¶
Tell wether two elements can be considered as a match
frame_occurrence_elem is a seen element, while frame_elem can contain a set of possible elements, such as prepositions
- _matching_baseline(verbnet_frame, slots_associations)[source]¶
Matching algorithm that is the closest to the article’s method
- _matching_stop_on_fail(verbnet_frame, slots_associations)[source]¶
Stop the algorithm at the first mismatch encountered
- _matching_sync_predicates(verbnet_frame, slots_associations)[source]¶
Stop the algorithm at the first mismatch encountered after the verb, restart at the verb’s position if a mismatch is encountered before the verb
- frame_semantic_score(frame_data, semantic_data)[source]¶
For a given frame from VerbNet, compute a semantic score between this frame and the headwords of the real frame associated with FrameMatcher.
Parameters: - frame_data ((VerbnetOfficialFrame, int List)) – The frame and the associated mapping
- semantic_data ((VNRestriction -> (str Counter)) NoHashDefaultDict) – The gathered relations between restrictions and words
- get_matched_restrictions()[source]¶
Returns the list of restrictions for which we know a given word was a match. Only headwords of arguments for which we attributed exactly one possible role are taken into account. The restriction associated to them is the OR the restrictions associated to this slot in every possible frame.
Returns: VNRestriction Dict – a mapping between head words and the restriction they match
- handle_semantic_restrictions(data)[source]¶
Keep only frames for which the syntactic restriction are the best matched
Parameters: data ((VNRestriction -> (str Counter)) NoHashDefaultDict) – The gathered relations between restrictions and words