gossminn
commited on
Commit
•
0648f19
0
Parent(s):
Initial version
Browse files- .gitignore +1 -0
- app.py +106 -0
- data/2002829_mapped_roles.csv +40 -0
- data/2002829_temporal_data.json +29 -0
- kicktionary_lu_info.xml +0 -0
- notebook.ipynb +852 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.vscode/
|
app.py
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
import plotly.graph_objects as go
|
5 |
+
import plotly.express as px
|
6 |
+
|
7 |
+
from ast import literal_eval
|
8 |
+
from lxml import etree as ET
|
9 |
+
|
10 |
+
|
11 |
+
def prepare_data():
|
12 |
+
data = pd.read_csv(
|
13 |
+
"data/2002829_mapped_roles.csv", index_col=0,
|
14 |
+
converters={"frame": literal_eval, "changed_roles": literal_eval, "unchanged_roles": literal_eval, "roles": literal_eval}
|
15 |
+
)
|
16 |
+
|
17 |
+
frame_to_scenario, frame_to_super_scenario = load_kicktionary_info()
|
18 |
+
|
19 |
+
# extract information from "frame" tuples, filter & reorder columns
|
20 |
+
data_ = (
|
21 |
+
data
|
22 |
+
.assign(sentence_idx=data["frame"].apply(lambda frame: frame[0]))
|
23 |
+
.assign(frame_idx=data["frame"].apply(lambda frame: frame[1]))
|
24 |
+
.assign(frame_name=data["frame"].apply(lambda frame: frame[2]))
|
25 |
+
.assign(frame_scenario=data["frame"].apply(lambda frame: frame_to_scenario[frame[2]]))
|
26 |
+
.assign(frame_super_scenario=data["frame"].apply(lambda frame: frame_to_super_scenario[frame[2]]))
|
27 |
+
.assign(frame_target=data["frame"].apply(lambda frame: frame[3]))
|
28 |
+
.drop(columns=["frame"])
|
29 |
+
)[["sentence_idx", "frame_idx", "frame_name", "frame_scenario", "frame_super_scenario", "frame_target", "changed_roles", "roles"]]
|
30 |
+
|
31 |
+
# assign value in 0 < t < 1 to represent each frame instance's "time" point in the article
|
32 |
+
max_sent = max(data_["sentence_idx"])
|
33 |
+
max_frame_per_sent = data_.groupby("sentence_idx").agg({"frame_idx": max}).reset_index()
|
34 |
+
sent_to_max_frame = dict(zip(max_frame_per_sent["sentence_idx"], max_frame_per_sent["frame_idx"]))
|
35 |
+
data_with_time = data_.assign(
|
36 |
+
time_point= (data_
|
37 |
+
.apply(lambda row: (row["sentence_idx"] + row["frame_idx"] / (sent_to_max_frame[row["sentence_idx"]])) / (max_sent + 1), axis=1)
|
38 |
+
)
|
39 |
+
)
|
40 |
+
data_with_first_roles = data_with_time.assign(
|
41 |
+
first_role = data_with_time["changed_roles"].apply(lambda roles: roles[0] if len(roles) > 0 else None)
|
42 |
+
)
|
43 |
+
return data_with_first_roles
|
44 |
+
|
45 |
+
|
46 |
+
def load_kicktionary_info():
|
47 |
+
|
48 |
+
kicktionary = ET.parse("kicktionary_lu_info.xml")
|
49 |
+
frame_to_scenario = {
|
50 |
+
lu.attrib["frame"]: lu.attrib["scenario"]
|
51 |
+
for lu in kicktionary.xpath(".//LEXICAL-UNIT") if lu.attrib["frame"]
|
52 |
+
}
|
53 |
+
frame_to_super_scenario = {
|
54 |
+
lu.attrib["frame"]: lu.attrib["super-scenario"]
|
55 |
+
for lu in kicktionary.xpath(".//LEXICAL-UNIT") if lu.attrib["frame"]
|
56 |
+
}
|
57 |
+
|
58 |
+
return frame_to_scenario, frame_to_super_scenario
|
59 |
+
|
60 |
+
|
61 |
+
def explore_timeline():
|
62 |
+
|
63 |
+
with st.container():
|
64 |
+
|
65 |
+
st.title("Football Perspective Chains")
|
66 |
+
|
67 |
+
frame_label_map = {
|
68 |
+
"frame_name": "frames",
|
69 |
+
"frame_scenario": "scenarios (groups of related frames)",
|
70 |
+
"frame_super_scenario": "super scenarios (groups of related scenarios)"
|
71 |
+
}
|
72 |
+
frame_column = st.selectbox(
|
73 |
+
label="Display frames as: ",
|
74 |
+
options=("frame_name", "frame_scenario", "frame_super_scenario"),
|
75 |
+
format_func=lambda label: frame_label_map[label]
|
76 |
+
)
|
77 |
+
|
78 |
+
st.header("Timeline")
|
79 |
+
data = prepare_data()
|
80 |
+
time_scatter = (
|
81 |
+
data
|
82 |
+
.dropna(axis=0, subset=["first_role"])
|
83 |
+
.plot.scatter(
|
84 |
+
x="first_role", y="time_point", backend="plotly", color=frame_column
|
85 |
+
)
|
86 |
+
)
|
87 |
+
time_scatter.update_traces(marker_size=20)
|
88 |
+
time_scatter.update_layout(height=1000)
|
89 |
+
st.plotly_chart(time_scatter)
|
90 |
+
|
91 |
+
st.header("Overall focus")
|
92 |
+
focus_bar = data.dropna(axis=0, subset=["first_role"])["first_role"].value_counts().plot.bar(y="first_role", backend="plotly")
|
93 |
+
st.plotly_chart(focus_bar)
|
94 |
+
|
95 |
+
st.header("Focus by frame")
|
96 |
+
|
97 |
+
for team in ["Man. United", "Rangers"]:
|
98 |
+
st.subheader(team)
|
99 |
+
frame_bar = data.dropna(axis=0, subset=["first_role"])["frame_scenario"].value_counts().plot.bar(y=frame_column, backend="plotly")
|
100 |
+
st.plotly_chart(frame_bar)
|
101 |
+
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
if __name__ == "__main__":
|
106 |
+
explore_timeline()
|
data/2002829_mapped_roles.csv
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,frame,changed_roles,unchanged_roles,roles,changed_role
|
2 |
+
0,"(0, 0, 'Draw', 'draw', 'NOUN')",['Rangers'],"[('COMPETITION_STAGE', ['from', 'a', 'tight', 'Anglo-Scottish', 'Group', 'C', 'contest']), ('FINAL_SCORE', ['goalless']), ('MATCH_LOCATION', ['at', 'Old', 'Trafford'])]","[('COMPETITION_STAGE', ['from', 'a', 'tight', 'Anglo-Scottish', 'Group', 'C', 'contest']), ('FINAL_SCORE', ['goalless']), ('MATCH_LOCATION', ['at', 'Old', 'Trafford']), ('TEAM1', ['Rangers', 'FC'])]",Changed Something
|
3 |
+
1,"(0, 1, 'Match', 'contest', 'NOUN')",[],"[('MATCH_LOCATION', ['at', 'Old', 'Trafford']), ('COMPETITION_STAGE', ['Anglo-Scottish', 'Group', 'C'])]","[('MATCH_LOCATION', ['at', 'Old', 'Trafford']), ('COMPETITION_STAGE', ['Anglo-Scottish', 'Group', 'C'])]",No Changed
|
4 |
+
2,"(1, 0, 'Competition', 'titleholders', 'NOUN')",[],"[('TEAM', ['Scottish'])]","[('TEAM', ['Scottish'])]",No Changed
|
5 |
+
3,"(1, 1, 'Concede_Goal', 'conceded', 'VERB')",['Rangers'],"[('CONCEDING_TEAM', ['they']), ('GOAL', ['more', 'goals'])]","[('CONCEDING_TEAM', ['they']), ('CONCEDING_TEAM', ['Walter', 'Smith', ""'s"", 'Scottish', 'titleholders']), ('GOAL', ['more', 'goals'])]",Changed Something
|
6 |
+
4,"(1, 2, 'Competition_Stage', 'group', 'NOUN')",[],"[('COMPETITION', ['UEFA', 'Champions', 'League'])]","[('COMPETITION', ['UEFA', 'Champions', 'League'])]",No Changed
|
7 |
+
5,"(1, 3, 'Bring_Off', 'return', 'VERB')",['Man. United'],"[('TARGET', ['north', 'of', 'the', 'border'])]","[('SUBSTITUTED_PLAYER', ['Antonio', 'Valencia']), ('TARGET', ['north', 'of', 'the', 'border'])]",Changed Something
|
8 |
+
6,"(1, 6, 'Bring_Off', 'departing', 'VERB')",['Man. United'],[],"[('SUBSTITUTED_PLAYER', ['Antonio', 'Valencia'])]",All changed
|
9 |
+
7,"(1, 8, 'Match_Temporal_Subdivision', 'period', 'NOUN')",[],"[('FIRST_OR_SECOND', ['second'])]","[('FIRST_OR_SECOND', ['second'])]",No Changed
|
10 |
+
8,"(2, 0, 'Team', 'team', 'NOUN')",[],"[('TEAM', ['Scottish'])]","[('TEAM', ['Scottish'])]",No Changed
|
11 |
+
9,"(2, 1, 'Competition', 'elite', 'NOUN')",[],"[('COMPETITION', ['Europe', ""'s""])]","[('COMPETITION', ['Europe', ""'s""])]",No Changed
|
12 |
+
10,"(2, 2, 'Competition', 'competition', 'NOUN')",[],"[('COMPETITION', ['Europe', ""'s""])]","[('COMPETITION', ['Europe', ""'s""])]",No Changed
|
13 |
+
11,"(2, 3, 'Victory', 'triumph', 'NOUN')",['Man. United'],[],"[('MATCH_LOCATION', ['at', 'Leeds', 'United', 'AFC'])]",All changed
|
14 |
+
12,"(2, 4, 'Deploy', 'fielding', 'NOUN')",['Rangers'],"[('COACH', ['his']), ('PLAYER', ['of', 'three', 'central', 'defenders'])]","[('COACH', ['his']), ('PLAYER', ['of', 'three', 'central', 'defenders']), ('PLAYER', ['in', 'Madjid', 'Bougherra', ',', 'David', 'Weir', 'and', 'Saša', 'Papac'])]",Changed Something
|
15 |
+
13,"(2, 5, 'Player', 'full-backs', 'NOUN')",['Rangers'],[],"[('PLAYER', ['Steven', 'Whittaker', 'and', 'Kirk', 'Broadfoot'])]",All changed
|
16 |
+
14,"(3, 1, 'Draw', 'draw', 'NOUN')",['Man. United'],"[('MATCH_LOCATION', ['at', 'Everton'])]","[('TEAM1', ['United', ""'s""]), ('MATCH_LOCATION', ['at', 'Everton'])]",Changed Something
|
17 |
+
15,"(3, 2, 'Shot', 'nod', 'VERB')",['Man. United'],"[('SHOOTER', ['he']), ('TARGET', ['just', 'wide', 'of', 'the', 'near', 'post'])]","[('MOVING_BALL', ['Fabio', ""'s"", 'right-wing', 'cross']), ('SHOOTER', ['he']), ('TARGET', ['just', 'wide', 'of', 'the', 'near', 'post'])]",Changed Something
|
18 |
+
16,"(3, 3, 'Pass', 'cross', 'NOUN')",['Man. United'],"[('TARGET', ['right-wing'])]","[('TARGET', ['right-wing']), ('PASSER', ['Fabio', ""'s""])]",Changed Something
|
19 |
+
17,"(3, 4, 'Goal_Target', 'post', 'NOUN')",[],"[('DISTANCE_TO_BALL', ['near'])]","[('DISTANCE_TO_BALL', ['near'])]",No Changed
|
20 |
+
18,"(3, 5, 'One_On_One', 'two-on-one', 'NOUN')","['Man. United', 'Rangers', 'Man. United']","[('PLAYER1', ['he'])]","[('MOVING_BALL', ['Fabio', ""'s"", 'right-wing', 'cross']), ('PLAYER2', ['with', 'Bougherra']), ('PLAYER1', ['he']), ('PLAYER1', ['he', 'and', 'the', 'recalled', 'Wayne', 'Rooney'])]",Changed Something
|
21 |
+
19,"(3, 6, 'Pass', 'pass', 'NOUN')",[],"[('PASSER', ['his'])]","[('PASSER', ['his'])]",No Changed
|
22 |
+
20,"(3, 7, 'Intervene', 'avert', 'VERB')",['Rangers'],"[('SHOT', ['the', 'threat'])]","[('SHOT', ['the', 'threat']), ('INTERVENING_PLAYER', ['Weir'])]",Changed Something
|
23 |
+
21,"(4, 0, 'Shot', 'drive', 'NOUN')",[],"[('PATH', ['low'])]","[('PATH', ['low'])]",No Changed
|
24 |
+
22,"(4, 1, 'Ball_Move', 'whistled', 'VERB')",[],"[('MOVING_BALL', ['a', 'low', 'drive']), ('TARGET', ['past', 'the', 'goal', 'frame'])]","[('MOVING_BALL', ['a', 'low', 'drive']), ('TARGET', ['past', 'the', 'goal', 'frame'])]",No Changed
|
25 |
+
23,"(4, 3, 'Player', 'midfielder', 'NOUN')",[],"[('TEAM', ['Irish'])]","[('TEAM', ['Irish'])]",No Changed
|
26 |
+
24,"(4, 5, 'Shot', 'volleying', 'VERB')",[],"[('SOURCE', ['from', 'the', 'edge', 'of', 'the', 'area']), ('TARGET', ['wide']), ('SHOOTER', ['the', 'Irish', 'midfielder'])]","[('SOURCE', ['from', 'the', 'edge', 'of', 'the', 'area']), ('TARGET', ['wide']), ('SHOOTER', ['the', 'Irish', 'midfielder'])]",No Changed
|
27 |
+
25,"(4, 7, 'Being_Free', 'isolated', 'VERB')",['Rangers'],[],"[('RECIPIENT', ['Kenny', 'Miller'])]",All changed
|
28 |
+
26,"(4, 9, 'Team', 'defence', 'NOUN')",['Man. United'],[],"[('TEAM', ['United', ""'s""])]",All changed
|
29 |
+
27,"(5, 0, 'Control', 'got', 'VERB')","['Rangers', 'Man. United', 'Rangers']",[],"[('RECIPIENT', ['Kirk', 'Broadfoot']), ('RECIPIENT', ['Darren', 'Fletcher']), ('RECIPIENT', ['Papac'])]",All changed
|
30 |
+
28,"(5, 1, 'Pass', 'cross', 'NOUN')",['Rangers'],[],"[('PASSER', ['Steven', 'Naismith'])]",All changed
|
31 |
+
29,"(5, 2, 'Intercept', 'interception', 'NOUN')",[],"[('INTERCEPTOR', ['his', 'own'])]","[('INTERCEPTOR', ['his', 'own'])]",No Changed
|
32 |
+
30,"(5, 3, 'Challenge', 'challenge', 'NOUN')",['Man. United'],[],"[('OPPONENT_PLAYER', ['Smalling'])]",All changed
|
33 |
+
31,"(5, 4, 'Field', 'edge', 'NOUN')",['Man. United'],[],"[('TEAM', ['United'])]",All changed
|
34 |
+
32,"(5, 5, 'Referee', 'referee', 'VERB')",[],"[('REFEREE', ['Olegário', 'Benquerença'])]","[('REFEREE', ['Olegário', 'Benquerença'])]",No Changed
|
35 |
+
33,"(5, 6, 'Control', 'latching', 'VERB')",['Rangers'],[],"[('RECIPIENT', ['Kirk', 'Broadfoot'])]",All changed
|
36 |
+
34,"(5, 7, 'Shot', 'lofted', 'VERB')",['Man. United'],"[('TARGET', ['over', 'the', 'top'])]","[('TARGET', ['over', 'the', 'top']), ('SHOOTER', ['Ryan', 'Giggs', ""'s""])]",Changed Something
|
37 |
+
35,"(5, 8, 'Pass', 'ball', 'NOUN')",['Man. United'],"[('TARGET', ['over', 'the', 'top'])]","[('TARGET', ['over', 'the', 'top']), ('PASSER', ['Ryan', 'Giggs', ""'s""])]",Changed Something
|
38 |
+
36,"(5, 10, 'Shot_Supports', 'shot', 'VERB')",['Man. United'],[],"[('SHOOTER', ['Gibson'])]",All changed
|
39 |
+
37,"(5, 11, 'Shot', 'whisker', 'NOUN')",['Man. United'],"[('TARGET', ['over'])]","[('TARGET', ['over']), ('SHOOTER', ['Gibson'])]",Changed Something
|
40 |
+
38,"(5, 13, 'Score_Goal', 'claim', 'VERB')",[],"[('GOAL', ['their', 'point']), ('REFEREE', ['referee', 'Olegário', 'Benquerença'])]","[('GOAL', ['their', 'point']), ('REFEREE', ['referee', 'Olegário', 'Benquerença'])]",No Changed
|
data/2002829_temporal_data.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Rangers": [
|
3 |
+
"(0, 0, 'Draw', 'draw', 'NOUN')",
|
4 |
+
"(1, 1, 'Concede_Goal', 'conceded', 'VERB')",
|
5 |
+
"(2, 4, 'Deploy', 'fielding', 'NOUN')",
|
6 |
+
"(2, 5, 'Player', 'full-backs', 'NOUN')",
|
7 |
+
"(3, 7, 'Intervene', 'avert', 'VERB')",
|
8 |
+
"(4, 7, 'Being_Free', 'isolated', 'VERB')",
|
9 |
+
"(5, 0, 'Control', 'got', 'VERB')",
|
10 |
+
"(5, 1, 'Pass', 'cross', 'NOUN')",
|
11 |
+
"(5, 6, 'Control', 'latching', 'VERB')"
|
12 |
+
],
|
13 |
+
"Man. United": [
|
14 |
+
"(1, 3, 'Bring_Off', 'return', 'VERB')",
|
15 |
+
"(1, 6, 'Bring_Off', 'departing', 'VERB')",
|
16 |
+
"(2, 3, 'Victory', 'triumph', 'NOUN')",
|
17 |
+
"(3, 1, 'Draw', 'draw', 'NOUN')",
|
18 |
+
"(3, 2, 'Shot', 'nod', 'VERB')",
|
19 |
+
"(3, 3, 'Pass', 'cross', 'NOUN')",
|
20 |
+
"(3, 5, 'One_On_One', 'two-on-one', 'NOUN')",
|
21 |
+
"(4, 9, 'Team', 'defence', 'NOUN')",
|
22 |
+
"(5, 3, 'Challenge', 'challenge', 'NOUN')",
|
23 |
+
"(5, 4, 'Field', 'edge', 'NOUN')",
|
24 |
+
"(5, 7, 'Shot', 'lofted', 'VERB')",
|
25 |
+
"(5, 8, 'Pass', 'ball', 'NOUN')",
|
26 |
+
"(5, 10, 'Shot_Supports', 'shot', 'VERB')",
|
27 |
+
"(5, 11, 'Shot', 'whisker', 'NOUN')"
|
28 |
+
]
|
29 |
+
}
|
kicktionary_lu_info.xml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
notebook.ipynb
ADDED
@@ -0,0 +1,852 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 7,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import pandas as pd\n",
|
10 |
+
"import os\n",
|
11 |
+
"from rich import print\n",
|
12 |
+
"os.chdir(\"/home/p289731/NWO_FrameNet/Code/football-chains-viz\")"
|
13 |
+
]
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"cell_type": "code",
|
17 |
+
"execution_count": 11,
|
18 |
+
"metadata": {},
|
19 |
+
"outputs": [],
|
20 |
+
"source": [
|
21 |
+
"from ast import literal_eval"
|
22 |
+
]
|
23 |
+
},
|
24 |
+
{
|
25 |
+
"cell_type": "code",
|
26 |
+
"execution_count": 21,
|
27 |
+
"metadata": {},
|
28 |
+
"outputs": [
|
29 |
+
{
|
30 |
+
"data": {
|
31 |
+
"text/html": [
|
32 |
+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">39</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span><span style=\"font-weight: bold\">)</span>\n",
|
33 |
+
"</pre>\n"
|
34 |
+
],
|
35 |
+
"text/plain": [
|
36 |
+
"\u001b[1m(\u001b[0m\u001b[1;36m39\u001b[0m, \u001b[1;36m5\u001b[0m\u001b[1m)\u001b[0m\n"
|
37 |
+
]
|
38 |
+
},
|
39 |
+
"metadata": {},
|
40 |
+
"output_type": "display_data"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"data": {
|
44 |
+
"text/html": [
|
45 |
+
"<div>\n",
|
46 |
+
"<style scoped>\n",
|
47 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
48 |
+
" vertical-align: middle;\n",
|
49 |
+
" }\n",
|
50 |
+
"\n",
|
51 |
+
" .dataframe tbody tr th {\n",
|
52 |
+
" vertical-align: top;\n",
|
53 |
+
" }\n",
|
54 |
+
"\n",
|
55 |
+
" .dataframe thead th {\n",
|
56 |
+
" text-align: right;\n",
|
57 |
+
" }\n",
|
58 |
+
"</style>\n",
|
59 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
60 |
+
" <thead>\n",
|
61 |
+
" <tr style=\"text-align: right;\">\n",
|
62 |
+
" <th></th>\n",
|
63 |
+
" <th>frame</th>\n",
|
64 |
+
" <th>changed_roles</th>\n",
|
65 |
+
" <th>unchanged_roles</th>\n",
|
66 |
+
" <th>roles</th>\n",
|
67 |
+
" <th>changed_role</th>\n",
|
68 |
+
" </tr>\n",
|
69 |
+
" </thead>\n",
|
70 |
+
" <tbody>\n",
|
71 |
+
" <tr>\n",
|
72 |
+
" <th>0</th>\n",
|
73 |
+
" <td>(0, 0, Draw, draw, NOUN)</td>\n",
|
74 |
+
" <td>[Rangers]</td>\n",
|
75 |
+
" <td>[(COMPETITION_STAGE, [from, a, tight, Anglo-Sc...</td>\n",
|
76 |
+
" <td>[(COMPETITION_STAGE, [from, a, tight, Anglo-Sc...</td>\n",
|
77 |
+
" <td>Changed Something</td>\n",
|
78 |
+
" </tr>\n",
|
79 |
+
" <tr>\n",
|
80 |
+
" <th>1</th>\n",
|
81 |
+
" <td>(0, 1, Match, contest, NOUN)</td>\n",
|
82 |
+
" <td>[]</td>\n",
|
83 |
+
" <td>[(MATCH_LOCATION, [at, Old, Trafford]), (COMPE...</td>\n",
|
84 |
+
" <td>[(MATCH_LOCATION, [at, Old, Trafford]), (COMPE...</td>\n",
|
85 |
+
" <td>No Changed</td>\n",
|
86 |
+
" </tr>\n",
|
87 |
+
" <tr>\n",
|
88 |
+
" <th>2</th>\n",
|
89 |
+
" <td>(1, 0, Competition, titleholders, NOUN)</td>\n",
|
90 |
+
" <td>[]</td>\n",
|
91 |
+
" <td>[(TEAM, [Scottish])]</td>\n",
|
92 |
+
" <td>[(TEAM, [Scottish])]</td>\n",
|
93 |
+
" <td>No Changed</td>\n",
|
94 |
+
" </tr>\n",
|
95 |
+
" <tr>\n",
|
96 |
+
" <th>3</th>\n",
|
97 |
+
" <td>(1, 1, Concede_Goal, conceded, VERB)</td>\n",
|
98 |
+
" <td>[Rangers]</td>\n",
|
99 |
+
" <td>[(CONCEDING_TEAM, [they]), (GOAL, [more, goals])]</td>\n",
|
100 |
+
" <td>[(CONCEDING_TEAM, [they]), (CONCEDING_TEAM, [W...</td>\n",
|
101 |
+
" <td>Changed Something</td>\n",
|
102 |
+
" </tr>\n",
|
103 |
+
" <tr>\n",
|
104 |
+
" <th>4</th>\n",
|
105 |
+
" <td>(1, 2, Competition_Stage, group, NOUN)</td>\n",
|
106 |
+
" <td>[]</td>\n",
|
107 |
+
" <td>[(COMPETITION, [UEFA, Champions, League])]</td>\n",
|
108 |
+
" <td>[(COMPETITION, [UEFA, Champions, League])]</td>\n",
|
109 |
+
" <td>No Changed</td>\n",
|
110 |
+
" </tr>\n",
|
111 |
+
" </tbody>\n",
|
112 |
+
"</table>\n",
|
113 |
+
"</div>"
|
114 |
+
],
|
115 |
+
"text/plain": [
|
116 |
+
" frame changed_roles \\\n",
|
117 |
+
"0 (0, 0, Draw, draw, NOUN) [Rangers] \n",
|
118 |
+
"1 (0, 1, Match, contest, NOUN) [] \n",
|
119 |
+
"2 (1, 0, Competition, titleholders, NOUN) [] \n",
|
120 |
+
"3 (1, 1, Concede_Goal, conceded, VERB) [Rangers] \n",
|
121 |
+
"4 (1, 2, Competition_Stage, group, NOUN) [] \n",
|
122 |
+
"\n",
|
123 |
+
" unchanged_roles \\\n",
|
124 |
+
"0 [(COMPETITION_STAGE, [from, a, tight, Anglo-Sc... \n",
|
125 |
+
"1 [(MATCH_LOCATION, [at, Old, Trafford]), (COMPE... \n",
|
126 |
+
"2 [(TEAM, [Scottish])] \n",
|
127 |
+
"3 [(CONCEDING_TEAM, [they]), (GOAL, [more, goals])] \n",
|
128 |
+
"4 [(COMPETITION, [UEFA, Champions, League])] \n",
|
129 |
+
"\n",
|
130 |
+
" roles changed_role \n",
|
131 |
+
"0 [(COMPETITION_STAGE, [from, a, tight, Anglo-Sc... Changed Something \n",
|
132 |
+
"1 [(MATCH_LOCATION, [at, Old, Trafford]), (COMPE... No Changed \n",
|
133 |
+
"2 [(TEAM, [Scottish])] No Changed \n",
|
134 |
+
"3 [(CONCEDING_TEAM, [they]), (CONCEDING_TEAM, [W... Changed Something \n",
|
135 |
+
"4 [(COMPETITION, [UEFA, Champions, League])] No Changed "
|
136 |
+
]
|
137 |
+
},
|
138 |
+
"execution_count": 21,
|
139 |
+
"metadata": {},
|
140 |
+
"output_type": "execute_result"
|
141 |
+
}
|
142 |
+
],
|
143 |
+
"source": [
|
144 |
+
"data = pd.read_csv(\n",
|
145 |
+
" \"data/2002829_mapped_roles.csv\", index_col=0, \n",
|
146 |
+
" converters={\"frame\": literal_eval, \"changed_roles\": literal_eval, \"unchanged_roles\": literal_eval, \"roles\": literal_eval}\n",
|
147 |
+
" )\n",
|
148 |
+
"print(data.shape)\n",
|
149 |
+
"data.head()"
|
150 |
+
]
|
151 |
+
},
|
152 |
+
{
|
153 |
+
"cell_type": "code",
|
154 |
+
"execution_count": 30,
|
155 |
+
"metadata": {},
|
156 |
+
"outputs": [
|
157 |
+
{
|
158 |
+
"data": {
|
159 |
+
"text/html": [
|
160 |
+
"<div>\n",
|
161 |
+
"<style scoped>\n",
|
162 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
163 |
+
" vertical-align: middle;\n",
|
164 |
+
" }\n",
|
165 |
+
"\n",
|
166 |
+
" .dataframe tbody tr th {\n",
|
167 |
+
" vertical-align: top;\n",
|
168 |
+
" }\n",
|
169 |
+
"\n",
|
170 |
+
" .dataframe thead th {\n",
|
171 |
+
" text-align: right;\n",
|
172 |
+
" }\n",
|
173 |
+
"</style>\n",
|
174 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
175 |
+
" <thead>\n",
|
176 |
+
" <tr style=\"text-align: right;\">\n",
|
177 |
+
" <th></th>\n",
|
178 |
+
" <th>sentence_idx</th>\n",
|
179 |
+
" <th>frame_idx</th>\n",
|
180 |
+
" <th>frame_name</th>\n",
|
181 |
+
" <th>frame_target</th>\n",
|
182 |
+
" <th>changed_roles</th>\n",
|
183 |
+
" <th>roles</th>\n",
|
184 |
+
" </tr>\n",
|
185 |
+
" </thead>\n",
|
186 |
+
" <tbody>\n",
|
187 |
+
" <tr>\n",
|
188 |
+
" <th>0</th>\n",
|
189 |
+
" <td>0</td>\n",
|
190 |
+
" <td>0</td>\n",
|
191 |
+
" <td>Draw</td>\n",
|
192 |
+
" <td>draw</td>\n",
|
193 |
+
" <td>[Rangers]</td>\n",
|
194 |
+
" <td>[(COMPETITION_STAGE, [from, a, tight, Anglo-Sc...</td>\n",
|
195 |
+
" </tr>\n",
|
196 |
+
" <tr>\n",
|
197 |
+
" <th>1</th>\n",
|
198 |
+
" <td>0</td>\n",
|
199 |
+
" <td>1</td>\n",
|
200 |
+
" <td>Match</td>\n",
|
201 |
+
" <td>contest</td>\n",
|
202 |
+
" <td>[]</td>\n",
|
203 |
+
" <td>[(MATCH_LOCATION, [at, Old, Trafford]), (COMPE...</td>\n",
|
204 |
+
" </tr>\n",
|
205 |
+
" <tr>\n",
|
206 |
+
" <th>2</th>\n",
|
207 |
+
" <td>1</td>\n",
|
208 |
+
" <td>0</td>\n",
|
209 |
+
" <td>Competition</td>\n",
|
210 |
+
" <td>titleholders</td>\n",
|
211 |
+
" <td>[]</td>\n",
|
212 |
+
" <td>[(TEAM, [Scottish])]</td>\n",
|
213 |
+
" </tr>\n",
|
214 |
+
" <tr>\n",
|
215 |
+
" <th>3</th>\n",
|
216 |
+
" <td>1</td>\n",
|
217 |
+
" <td>1</td>\n",
|
218 |
+
" <td>Concede_Goal</td>\n",
|
219 |
+
" <td>conceded</td>\n",
|
220 |
+
" <td>[Rangers]</td>\n",
|
221 |
+
" <td>[(CONCEDING_TEAM, [they]), (CONCEDING_TEAM, [W...</td>\n",
|
222 |
+
" </tr>\n",
|
223 |
+
" <tr>\n",
|
224 |
+
" <th>4</th>\n",
|
225 |
+
" <td>1</td>\n",
|
226 |
+
" <td>2</td>\n",
|
227 |
+
" <td>Competition_Stage</td>\n",
|
228 |
+
" <td>group</td>\n",
|
229 |
+
" <td>[]</td>\n",
|
230 |
+
" <td>[(COMPETITION, [UEFA, Champions, League])]</td>\n",
|
231 |
+
" </tr>\n",
|
232 |
+
" </tbody>\n",
|
233 |
+
"</table>\n",
|
234 |
+
"</div>"
|
235 |
+
],
|
236 |
+
"text/plain": [
|
237 |
+
" sentence_idx frame_idx frame_name frame_target changed_roles \\\n",
|
238 |
+
"0 0 0 Draw draw [Rangers] \n",
|
239 |
+
"1 0 1 Match contest [] \n",
|
240 |
+
"2 1 0 Competition titleholders [] \n",
|
241 |
+
"3 1 1 Concede_Goal conceded [Rangers] \n",
|
242 |
+
"4 1 2 Competition_Stage group [] \n",
|
243 |
+
"\n",
|
244 |
+
" roles \n",
|
245 |
+
"0 [(COMPETITION_STAGE, [from, a, tight, Anglo-Sc... \n",
|
246 |
+
"1 [(MATCH_LOCATION, [at, Old, Trafford]), (COMPE... \n",
|
247 |
+
"2 [(TEAM, [Scottish])] \n",
|
248 |
+
"3 [(CONCEDING_TEAM, [they]), (CONCEDING_TEAM, [W... \n",
|
249 |
+
"4 [(COMPETITION, [UEFA, Champions, League])] "
|
250 |
+
]
|
251 |
+
},
|
252 |
+
"execution_count": 30,
|
253 |
+
"metadata": {},
|
254 |
+
"output_type": "execute_result"
|
255 |
+
}
|
256 |
+
],
|
257 |
+
"source": [
|
258 |
+
"# max_roles_per_frame = \n",
|
259 |
+
"data_ = (\n",
|
260 |
+
" data\n",
|
261 |
+
" .assign(sentence_idx=data[\"frame\"].apply(lambda frame: frame[0]))\n",
|
262 |
+
" .assign(frame_idx=data[\"frame\"].apply(lambda frame: frame[1]))\n",
|
263 |
+
" .assign(frame_name=data[\"frame\"].apply(lambda frame: frame[2]))\n",
|
264 |
+
" .assign(frame_target=data[\"frame\"].apply(lambda frame: frame[3]))\n",
|
265 |
+
" .drop(columns=[\"frame\"])\n",
|
266 |
+
")[[\"sentence_idx\", \"frame_idx\", \"frame_name\", \"frame_target\", \"changed_roles\", \"roles\"]]\n",
|
267 |
+
"data_.head()\n"
|
268 |
+
]
|
269 |
+
},
|
270 |
+
{
|
271 |
+
"cell_type": "code",
|
272 |
+
"execution_count": 38,
|
273 |
+
"metadata": {},
|
274 |
+
"outputs": [],
|
275 |
+
"source": [
|
276 |
+
"max_sent = max(data_[\"sentence_idx\"])\n",
|
277 |
+
"max_frame_per_sent = data_.groupby(\"sentence_idx\").agg({\"frame_idx\": max}).reset_index()\n",
|
278 |
+
"sent_to_max_frame = dict(zip(max_frame_per_sent[\"sentence_idx\"], max_frame_per_sent[\"frame_idx\"]))"
|
279 |
+
]
|
280 |
+
},
|
281 |
+
{
|
282 |
+
"cell_type": "code",
|
283 |
+
"execution_count": 64,
|
284 |
+
"metadata": {},
|
285 |
+
"outputs": [
|
286 |
+
{
|
287 |
+
"data": {
|
288 |
+
"text/html": [
|
289 |
+
"<div>\n",
|
290 |
+
"<style scoped>\n",
|
291 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
292 |
+
" vertical-align: middle;\n",
|
293 |
+
" }\n",
|
294 |
+
"\n",
|
295 |
+
" .dataframe tbody tr th {\n",
|
296 |
+
" vertical-align: top;\n",
|
297 |
+
" }\n",
|
298 |
+
"\n",
|
299 |
+
" .dataframe thead th {\n",
|
300 |
+
" text-align: right;\n",
|
301 |
+
" }\n",
|
302 |
+
"</style>\n",
|
303 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
304 |
+
" <thead>\n",
|
305 |
+
" <tr style=\"text-align: right;\">\n",
|
306 |
+
" <th></th>\n",
|
307 |
+
" <th>sentence_idx</th>\n",
|
308 |
+
" <th>frame_idx</th>\n",
|
309 |
+
" <th>frame_name</th>\n",
|
310 |
+
" <th>frame_target</th>\n",
|
311 |
+
" <th>changed_roles</th>\n",
|
312 |
+
" <th>roles</th>\n",
|
313 |
+
" <th>time_point</th>\n",
|
314 |
+
" <th>first_role</th>\n",
|
315 |
+
" </tr>\n",
|
316 |
+
" </thead>\n",
|
317 |
+
" <tbody>\n",
|
318 |
+
" <tr>\n",
|
319 |
+
" <th>0</th>\n",
|
320 |
+
" <td>0</td>\n",
|
321 |
+
" <td>0</td>\n",
|
322 |
+
" <td>Draw</td>\n",
|
323 |
+
" <td>draw</td>\n",
|
324 |
+
" <td>[Rangers]</td>\n",
|
325 |
+
" <td>[(COMPETITION_STAGE, [from, a, tight, Anglo-Sc...</td>\n",
|
326 |
+
" <td>0.000000</td>\n",
|
327 |
+
" <td>Rangers</td>\n",
|
328 |
+
" </tr>\n",
|
329 |
+
" <tr>\n",
|
330 |
+
" <th>3</th>\n",
|
331 |
+
" <td>1</td>\n",
|
332 |
+
" <td>1</td>\n",
|
333 |
+
" <td>Concede_Goal</td>\n",
|
334 |
+
" <td>conceded</td>\n",
|
335 |
+
" <td>[Rangers]</td>\n",
|
336 |
+
" <td>[(CONCEDING_TEAM, [they]), (CONCEDING_TEAM, [W...</td>\n",
|
337 |
+
" <td>0.187500</td>\n",
|
338 |
+
" <td>Rangers</td>\n",
|
339 |
+
" </tr>\n",
|
340 |
+
" <tr>\n",
|
341 |
+
" <th>5</th>\n",
|
342 |
+
" <td>1</td>\n",
|
343 |
+
" <td>3</td>\n",
|
344 |
+
" <td>Bring_Off</td>\n",
|
345 |
+
" <td>return</td>\n",
|
346 |
+
" <td>[Man. United]</td>\n",
|
347 |
+
" <td>[(SUBSTITUTED_PLAYER, [Antonio, Valencia]), (T...</td>\n",
|
348 |
+
" <td>0.229167</td>\n",
|
349 |
+
" <td>Man. United</td>\n",
|
350 |
+
" </tr>\n",
|
351 |
+
" <tr>\n",
|
352 |
+
" <th>6</th>\n",
|
353 |
+
" <td>1</td>\n",
|
354 |
+
" <td>6</td>\n",
|
355 |
+
" <td>Bring_Off</td>\n",
|
356 |
+
" <td>departing</td>\n",
|
357 |
+
" <td>[Man. United]</td>\n",
|
358 |
+
" <td>[(SUBSTITUTED_PLAYER, [Antonio, Valencia])]</td>\n",
|
359 |
+
" <td>0.291667</td>\n",
|
360 |
+
" <td>Man. United</td>\n",
|
361 |
+
" </tr>\n",
|
362 |
+
" <tr>\n",
|
363 |
+
" <th>11</th>\n",
|
364 |
+
" <td>2</td>\n",
|
365 |
+
" <td>3</td>\n",
|
366 |
+
" <td>Victory</td>\n",
|
367 |
+
" <td>triumph</td>\n",
|
368 |
+
" <td>[Man. United]</td>\n",
|
369 |
+
" <td>[(MATCH_LOCATION, [at, Leeds, United, AFC])]</td>\n",
|
370 |
+
" <td>0.433333</td>\n",
|
371 |
+
" <td>Man. United</td>\n",
|
372 |
+
" </tr>\n",
|
373 |
+
" <tr>\n",
|
374 |
+
" <th>12</th>\n",
|
375 |
+
" <td>2</td>\n",
|
376 |
+
" <td>4</td>\n",
|
377 |
+
" <td>Deploy</td>\n",
|
378 |
+
" <td>fielding</td>\n",
|
379 |
+
" <td>[Rangers]</td>\n",
|
380 |
+
" <td>[(COACH, [his]), (PLAYER, [of, three, central,...</td>\n",
|
381 |
+
" <td>0.466667</td>\n",
|
382 |
+
" <td>Rangers</td>\n",
|
383 |
+
" </tr>\n",
|
384 |
+
" <tr>\n",
|
385 |
+
" <th>13</th>\n",
|
386 |
+
" <td>2</td>\n",
|
387 |
+
" <td>5</td>\n",
|
388 |
+
" <td>Player</td>\n",
|
389 |
+
" <td>full-backs</td>\n",
|
390 |
+
" <td>[Rangers]</td>\n",
|
391 |
+
" <td>[(PLAYER, [Steven, Whittaker, and, Kirk, Broad...</td>\n",
|
392 |
+
" <td>0.500000</td>\n",
|
393 |
+
" <td>Rangers</td>\n",
|
394 |
+
" </tr>\n",
|
395 |
+
" <tr>\n",
|
396 |
+
" <th>14</th>\n",
|
397 |
+
" <td>3</td>\n",
|
398 |
+
" <td>1</td>\n",
|
399 |
+
" <td>Draw</td>\n",
|
400 |
+
" <td>draw</td>\n",
|
401 |
+
" <td>[Man. United]</td>\n",
|
402 |
+
" <td>[(TEAM1, [United, 's]), (MATCH_LOCATION, [at, ...</td>\n",
|
403 |
+
" <td>0.523810</td>\n",
|
404 |
+
" <td>Man. United</td>\n",
|
405 |
+
" </tr>\n",
|
406 |
+
" <tr>\n",
|
407 |
+
" <th>15</th>\n",
|
408 |
+
" <td>3</td>\n",
|
409 |
+
" <td>2</td>\n",
|
410 |
+
" <td>Shot</td>\n",
|
411 |
+
" <td>nod</td>\n",
|
412 |
+
" <td>[Man. United]</td>\n",
|
413 |
+
" <td>[(MOVING_BALL, [Fabio, 's, right-wing, cross])...</td>\n",
|
414 |
+
" <td>0.547619</td>\n",
|
415 |
+
" <td>Man. United</td>\n",
|
416 |
+
" </tr>\n",
|
417 |
+
" <tr>\n",
|
418 |
+
" <th>16</th>\n",
|
419 |
+
" <td>3</td>\n",
|
420 |
+
" <td>3</td>\n",
|
421 |
+
" <td>Pass</td>\n",
|
422 |
+
" <td>cross</td>\n",
|
423 |
+
" <td>[Man. United]</td>\n",
|
424 |
+
" <td>[(TARGET, [right-wing]), (PASSER, [Fabio, 's])]</td>\n",
|
425 |
+
" <td>0.571429</td>\n",
|
426 |
+
" <td>Man. United</td>\n",
|
427 |
+
" </tr>\n",
|
428 |
+
" <tr>\n",
|
429 |
+
" <th>18</th>\n",
|
430 |
+
" <td>3</td>\n",
|
431 |
+
" <td>5</td>\n",
|
432 |
+
" <td>One_On_One</td>\n",
|
433 |
+
" <td>two-on-one</td>\n",
|
434 |
+
" <td>[Man. United, Rangers, Man. United]</td>\n",
|
435 |
+
" <td>[(MOVING_BALL, [Fabio, 's, right-wing, cross])...</td>\n",
|
436 |
+
" <td>0.619048</td>\n",
|
437 |
+
" <td>Man. United</td>\n",
|
438 |
+
" </tr>\n",
|
439 |
+
" <tr>\n",
|
440 |
+
" <th>20</th>\n",
|
441 |
+
" <td>3</td>\n",
|
442 |
+
" <td>7</td>\n",
|
443 |
+
" <td>Intervene</td>\n",
|
444 |
+
" <td>avert</td>\n",
|
445 |
+
" <td>[Rangers]</td>\n",
|
446 |
+
" <td>[(SHOT, [the, threat]), (INTERVENING_PLAYER, [...</td>\n",
|
447 |
+
" <td>0.666667</td>\n",
|
448 |
+
" <td>Rangers</td>\n",
|
449 |
+
" </tr>\n",
|
450 |
+
" <tr>\n",
|
451 |
+
" <th>25</th>\n",
|
452 |
+
" <td>4</td>\n",
|
453 |
+
" <td>7</td>\n",
|
454 |
+
" <td>Being_Free</td>\n",
|
455 |
+
" <td>isolated</td>\n",
|
456 |
+
" <td>[Rangers]</td>\n",
|
457 |
+
" <td>[(RECIPIENT, [Kenny, Miller])]</td>\n",
|
458 |
+
" <td>0.796296</td>\n",
|
459 |
+
" <td>Rangers</td>\n",
|
460 |
+
" </tr>\n",
|
461 |
+
" <tr>\n",
|
462 |
+
" <th>26</th>\n",
|
463 |
+
" <td>4</td>\n",
|
464 |
+
" <td>9</td>\n",
|
465 |
+
" <td>Team</td>\n",
|
466 |
+
" <td>defence</td>\n",
|
467 |
+
" <td>[Man. United]</td>\n",
|
468 |
+
" <td>[(TEAM, [United, 's])]</td>\n",
|
469 |
+
" <td>0.833333</td>\n",
|
470 |
+
" <td>Man. United</td>\n",
|
471 |
+
" </tr>\n",
|
472 |
+
" <tr>\n",
|
473 |
+
" <th>27</th>\n",
|
474 |
+
" <td>5</td>\n",
|
475 |
+
" <td>0</td>\n",
|
476 |
+
" <td>Control</td>\n",
|
477 |
+
" <td>got</td>\n",
|
478 |
+
" <td>[Rangers, Man. United, Rangers]</td>\n",
|
479 |
+
" <td>[(RECIPIENT, [Kirk, Broadfoot]), (RECIPIENT, [...</td>\n",
|
480 |
+
" <td>0.833333</td>\n",
|
481 |
+
" <td>Rangers</td>\n",
|
482 |
+
" </tr>\n",
|
483 |
+
" <tr>\n",
|
484 |
+
" <th>28</th>\n",
|
485 |
+
" <td>5</td>\n",
|
486 |
+
" <td>1</td>\n",
|
487 |
+
" <td>Pass</td>\n",
|
488 |
+
" <td>cross</td>\n",
|
489 |
+
" <td>[Rangers]</td>\n",
|
490 |
+
" <td>[(PASSER, [Steven, Naismith])]</td>\n",
|
491 |
+
" <td>0.846154</td>\n",
|
492 |
+
" <td>Rangers</td>\n",
|
493 |
+
" </tr>\n",
|
494 |
+
" <tr>\n",
|
495 |
+
" <th>30</th>\n",
|
496 |
+
" <td>5</td>\n",
|
497 |
+
" <td>3</td>\n",
|
498 |
+
" <td>Challenge</td>\n",
|
499 |
+
" <td>challenge</td>\n",
|
500 |
+
" <td>[Man. United]</td>\n",
|
501 |
+
" <td>[(OPPONENT_PLAYER, [Smalling])]</td>\n",
|
502 |
+
" <td>0.871795</td>\n",
|
503 |
+
" <td>Man. United</td>\n",
|
504 |
+
" </tr>\n",
|
505 |
+
" <tr>\n",
|
506 |
+
" <th>31</th>\n",
|
507 |
+
" <td>5</td>\n",
|
508 |
+
" <td>4</td>\n",
|
509 |
+
" <td>Field</td>\n",
|
510 |
+
" <td>edge</td>\n",
|
511 |
+
" <td>[Man. United]</td>\n",
|
512 |
+
" <td>[(TEAM, [United])]</td>\n",
|
513 |
+
" <td>0.884615</td>\n",
|
514 |
+
" <td>Man. United</td>\n",
|
515 |
+
" </tr>\n",
|
516 |
+
" <tr>\n",
|
517 |
+
" <th>33</th>\n",
|
518 |
+
" <td>5</td>\n",
|
519 |
+
" <td>6</td>\n",
|
520 |
+
" <td>Control</td>\n",
|
521 |
+
" <td>latching</td>\n",
|
522 |
+
" <td>[Rangers]</td>\n",
|
523 |
+
" <td>[(RECIPIENT, [Kirk, Broadfoot])]</td>\n",
|
524 |
+
" <td>0.910256</td>\n",
|
525 |
+
" <td>Rangers</td>\n",
|
526 |
+
" </tr>\n",
|
527 |
+
" <tr>\n",
|
528 |
+
" <th>34</th>\n",
|
529 |
+
" <td>5</td>\n",
|
530 |
+
" <td>7</td>\n",
|
531 |
+
" <td>Shot</td>\n",
|
532 |
+
" <td>lofted</td>\n",
|
533 |
+
" <td>[Man. United]</td>\n",
|
534 |
+
" <td>[(TARGET, [over, the, top]), (SHOOTER, [Ryan, ...</td>\n",
|
535 |
+
" <td>0.923077</td>\n",
|
536 |
+
" <td>Man. United</td>\n",
|
537 |
+
" </tr>\n",
|
538 |
+
" <tr>\n",
|
539 |
+
" <th>35</th>\n",
|
540 |
+
" <td>5</td>\n",
|
541 |
+
" <td>8</td>\n",
|
542 |
+
" <td>Pass</td>\n",
|
543 |
+
" <td>ball</td>\n",
|
544 |
+
" <td>[Man. United]</td>\n",
|
545 |
+
" <td>[(TARGET, [over, the, top]), (PASSER, [Ryan, G...</td>\n",
|
546 |
+
" <td>0.935897</td>\n",
|
547 |
+
" <td>Man. United</td>\n",
|
548 |
+
" </tr>\n",
|
549 |
+
" <tr>\n",
|
550 |
+
" <th>36</th>\n",
|
551 |
+
" <td>5</td>\n",
|
552 |
+
" <td>10</td>\n",
|
553 |
+
" <td>Shot_Supports</td>\n",
|
554 |
+
" <td>shot</td>\n",
|
555 |
+
" <td>[Man. United]</td>\n",
|
556 |
+
" <td>[(SHOOTER, [Gibson])]</td>\n",
|
557 |
+
" <td>0.961538</td>\n",
|
558 |
+
" <td>Man. United</td>\n",
|
559 |
+
" </tr>\n",
|
560 |
+
" <tr>\n",
|
561 |
+
" <th>37</th>\n",
|
562 |
+
" <td>5</td>\n",
|
563 |
+
" <td>11</td>\n",
|
564 |
+
" <td>Shot</td>\n",
|
565 |
+
" <td>whisker</td>\n",
|
566 |
+
" <td>[Man. United]</td>\n",
|
567 |
+
" <td>[(TARGET, [over]), (SHOOTER, [Gibson])]</td>\n",
|
568 |
+
" <td>0.974359</td>\n",
|
569 |
+
" <td>Man. United</td>\n",
|
570 |
+
" </tr>\n",
|
571 |
+
" </tbody>\n",
|
572 |
+
"</table>\n",
|
573 |
+
"</div>"
|
574 |
+
],
|
575 |
+
"text/plain": [
|
576 |
+
" sentence_idx frame_idx frame_name frame_target \\\n",
|
577 |
+
"0 0 0 Draw draw \n",
|
578 |
+
"3 1 1 Concede_Goal conceded \n",
|
579 |
+
"5 1 3 Bring_Off return \n",
|
580 |
+
"6 1 6 Bring_Off departing \n",
|
581 |
+
"11 2 3 Victory triumph \n",
|
582 |
+
"12 2 4 Deploy fielding \n",
|
583 |
+
"13 2 5 Player full-backs \n",
|
584 |
+
"14 3 1 Draw draw \n",
|
585 |
+
"15 3 2 Shot nod \n",
|
586 |
+
"16 3 3 Pass cross \n",
|
587 |
+
"18 3 5 One_On_One two-on-one \n",
|
588 |
+
"20 3 7 Intervene avert \n",
|
589 |
+
"25 4 7 Being_Free isolated \n",
|
590 |
+
"26 4 9 Team defence \n",
|
591 |
+
"27 5 0 Control got \n",
|
592 |
+
"28 5 1 Pass cross \n",
|
593 |
+
"30 5 3 Challenge challenge \n",
|
594 |
+
"31 5 4 Field edge \n",
|
595 |
+
"33 5 6 Control latching \n",
|
596 |
+
"34 5 7 Shot lofted \n",
|
597 |
+
"35 5 8 Pass ball \n",
|
598 |
+
"36 5 10 Shot_Supports shot \n",
|
599 |
+
"37 5 11 Shot whisker \n",
|
600 |
+
"\n",
|
601 |
+
" changed_roles \\\n",
|
602 |
+
"0 [Rangers] \n",
|
603 |
+
"3 [Rangers] \n",
|
604 |
+
"5 [Man. United] \n",
|
605 |
+
"6 [Man. United] \n",
|
606 |
+
"11 [Man. United] \n",
|
607 |
+
"12 [Rangers] \n",
|
608 |
+
"13 [Rangers] \n",
|
609 |
+
"14 [Man. United] \n",
|
610 |
+
"15 [Man. United] \n",
|
611 |
+
"16 [Man. United] \n",
|
612 |
+
"18 [Man. United, Rangers, Man. United] \n",
|
613 |
+
"20 [Rangers] \n",
|
614 |
+
"25 [Rangers] \n",
|
615 |
+
"26 [Man. United] \n",
|
616 |
+
"27 [Rangers, Man. United, Rangers] \n",
|
617 |
+
"28 [Rangers] \n",
|
618 |
+
"30 [Man. United] \n",
|
619 |
+
"31 [Man. United] \n",
|
620 |
+
"33 [Rangers] \n",
|
621 |
+
"34 [Man. United] \n",
|
622 |
+
"35 [Man. United] \n",
|
623 |
+
"36 [Man. United] \n",
|
624 |
+
"37 [Man. United] \n",
|
625 |
+
"\n",
|
626 |
+
" roles time_point first_role \n",
|
627 |
+
"0 [(COMPETITION_STAGE, [from, a, tight, Anglo-Sc... 0.000000 Rangers \n",
|
628 |
+
"3 [(CONCEDING_TEAM, [they]), (CONCEDING_TEAM, [W... 0.187500 Rangers \n",
|
629 |
+
"5 [(SUBSTITUTED_PLAYER, [Antonio, Valencia]), (T... 0.229167 Man. United \n",
|
630 |
+
"6 [(SUBSTITUTED_PLAYER, [Antonio, Valencia])] 0.291667 Man. United \n",
|
631 |
+
"11 [(MATCH_LOCATION, [at, Leeds, United, AFC])] 0.433333 Man. United \n",
|
632 |
+
"12 [(COACH, [his]), (PLAYER, [of, three, central,... 0.466667 Rangers \n",
|
633 |
+
"13 [(PLAYER, [Steven, Whittaker, and, Kirk, Broad... 0.500000 Rangers \n",
|
634 |
+
"14 [(TEAM1, [United, 's]), (MATCH_LOCATION, [at, ... 0.523810 Man. United \n",
|
635 |
+
"15 [(MOVING_BALL, [Fabio, 's, right-wing, cross])... 0.547619 Man. United \n",
|
636 |
+
"16 [(TARGET, [right-wing]), (PASSER, [Fabio, 's])] 0.571429 Man. United \n",
|
637 |
+
"18 [(MOVING_BALL, [Fabio, 's, right-wing, cross])... 0.619048 Man. United \n",
|
638 |
+
"20 [(SHOT, [the, threat]), (INTERVENING_PLAYER, [... 0.666667 Rangers \n",
|
639 |
+
"25 [(RECIPIENT, [Kenny, Miller])] 0.796296 Rangers \n",
|
640 |
+
"26 [(TEAM, [United, 's])] 0.833333 Man. United \n",
|
641 |
+
"27 [(RECIPIENT, [Kirk, Broadfoot]), (RECIPIENT, [... 0.833333 Rangers \n",
|
642 |
+
"28 [(PASSER, [Steven, Naismith])] 0.846154 Rangers \n",
|
643 |
+
"30 [(OPPONENT_PLAYER, [Smalling])] 0.871795 Man. United \n",
|
644 |
+
"31 [(TEAM, [United])] 0.884615 Man. United \n",
|
645 |
+
"33 [(RECIPIENT, [Kirk, Broadfoot])] 0.910256 Rangers \n",
|
646 |
+
"34 [(TARGET, [over, the, top]), (SHOOTER, [Ryan, ... 0.923077 Man. United \n",
|
647 |
+
"35 [(TARGET, [over, the, top]), (PASSER, [Ryan, G... 0.935897 Man. United \n",
|
648 |
+
"36 [(SHOOTER, [Gibson])] 0.961538 Man. United \n",
|
649 |
+
"37 [(TARGET, [over]), (SHOOTER, [Gibson])] 0.974359 Man. United "
|
650 |
+
]
|
651 |
+
},
|
652 |
+
"execution_count": 64,
|
653 |
+
"metadata": {},
|
654 |
+
"output_type": "execute_result"
|
655 |
+
}
|
656 |
+
],
|
657 |
+
"source": [
|
658 |
+
"data_with_time = data_.assign(\n",
|
659 |
+
" time_point= (data_\n",
|
660 |
+
" .apply(lambda row: (row[\"sentence_idx\"] + row[\"frame_idx\"] / (sent_to_max_frame[row[\"sentence_idx\"]])) / (max_sent + 1), axis=1)\n",
|
661 |
+
" )\n",
|
662 |
+
")\n",
|
663 |
+
"\n",
|
664 |
+
"\n",
|
665 |
+
"data_with_first_roles = data_with_time.assign(\n",
|
666 |
+
" first_role = data_with_time[\"changed_roles\"].apply(lambda roles: roles[0] if len(roles) > 0 else None)\n",
|
667 |
+
")\n",
|
668 |
+
"\n",
|
669 |
+
"data_with_first_roles.dropna(axis=0, subset=[\"first_role\"])"
|
670 |
+
]
|
671 |
+
},
|
672 |
+
{
|
673 |
+
"cell_type": "code",
|
674 |
+
"execution_count": 66,
|
675 |
+
"metadata": {},
|
676 |
+
"outputs": [
|
677 |
+
{
|
678 |
+
"data": {
|
679 |
+
"text/plain": [
|
680 |
+
"Man. United 14\n",
|
681 |
+
"Rangers 9\n",
|
682 |
+
"Name: first_role, dtype: int64"
|
683 |
+
]
|
684 |
+
},
|
685 |
+
"execution_count": 66,
|
686 |
+
"metadata": {},
|
687 |
+
"output_type": "execute_result"
|
688 |
+
}
|
689 |
+
],
|
690 |
+
"source": [
|
691 |
+
"data_with_first_roles.dropna(axis=0, subset=[\"first_role\"])[\"first_role\"].value_counts()"
|
692 |
+
]
|
693 |
+
},
|
694 |
+
{
|
695 |
+
"cell_type": "code",
|
696 |
+
"execution_count": 76,
|
697 |
+
"metadata": {},
|
698 |
+
"outputs": [
|
699 |
+
{
|
700 |
+
"data": {
|
701 |
+
"text/plain": [
|
702 |
+
"{'Intervene': 'Shot',\n",
|
703 |
+
" 'Challenge': 'One_On_One',\n",
|
704 |
+
" 'Award_Goal': 'Goal',\n",
|
705 |
+
" 'Deny': 'One_On_One',\n",
|
706 |
+
" 'Intercept': 'Pass',\n",
|
707 |
+
" 'Shot_Supports': 'Shot',\n",
|
708 |
+
" 'Save': 'Shot',\n",
|
709 |
+
" 'Pass': 'Pass',\n",
|
710 |
+
" 'Ball_Bounce': 'Motion',\n",
|
711 |
+
" 'Mark': 'Pass',\n",
|
712 |
+
" 'Goal_Kickoff': 'Shot',\n",
|
713 |
+
" 'Finish': 'Shot',\n",
|
714 |
+
" 'Beat': 'One_On_One',\n",
|
715 |
+
" 'Offside': 'Foul',\n",
|
716 |
+
" 'Bad_Pass': 'Pass',\n",
|
717 |
+
" 'Goal': 'Goal',\n",
|
718 |
+
" 'Set_Piece': 'Foul',\n",
|
719 |
+
" 'Shot': 'Shot',\n",
|
720 |
+
" 'Player_Move_With_Ball': 'Motion',\n",
|
721 |
+
" 'Sanction': 'Foul',\n",
|
722 |
+
" 'Move': 'Move',\n",
|
723 |
+
" 'Control': 'Pass',\n",
|
724 |
+
" 'Shoot_At': 'Shot',\n",
|
725 |
+
" 'Start_End_Match': 'Match',\n",
|
726 |
+
" 'Match': 'Match',\n",
|
727 |
+
" 'Deploy': 'Lineup',\n",
|
728 |
+
" 'Start': 'Lineup',\n",
|
729 |
+
" 'Player_Move': 'Motion',\n",
|
730 |
+
" 'Elimination': 'Match',\n",
|
731 |
+
" 'Result': 'Match',\n",
|
732 |
+
" 'Bring_Off': 'Substitution',\n",
|
733 |
+
" 'Away_Game': 'Match',\n",
|
734 |
+
" 'Possession': 'State_Of_Match',\n",
|
735 |
+
" 'Pass_Combination': 'Pass',\n",
|
736 |
+
" 'Lose_Ball': 'One_On_One',\n",
|
737 |
+
" 'Defense_Shot': 'Mix-Up',\n",
|
738 |
+
" 'Receive_Card': 'Foul',\n",
|
739 |
+
" 'Victory': 'Match',\n",
|
740 |
+
" 'Supply_Pass': 'Pass',\n",
|
741 |
+
" 'Bring_On': 'Substitution',\n",
|
742 |
+
" 'Chance': 'Chance',\n",
|
743 |
+
" 'Multiple_Goals': 'Goal',\n",
|
744 |
+
" 'One_On_One': 'One_On_One',\n",
|
745 |
+
" 'Substitute': 'Substitution',\n",
|
746 |
+
" 'Own_Goal': 'Goal',\n",
|
747 |
+
" 'Convert_Chance': 'Goal',\n",
|
748 |
+
" 'Ball_Land': 'Motion',\n",
|
749 |
+
" 'Progression': 'Match',\n",
|
750 |
+
" 'Home_Game': 'Match',\n",
|
751 |
+
" 'Referee_Decision': 'Foul',\n",
|
752 |
+
" 'Concede_Goal': 'Goal',\n",
|
753 |
+
" 'Mistake': 'Mix-Up',\n",
|
754 |
+
" 'Tactics': 'State_Of_Match',\n",
|
755 |
+
" 'Foul': 'Foul',\n",
|
756 |
+
" 'Being_Free': 'Pass',\n",
|
757 |
+
" 'Lead': 'State_Of_Match',\n",
|
758 |
+
" 'Create_Chance': 'Chance',\n",
|
759 |
+
" 'Win_Compensation': 'Foul',\n",
|
760 |
+
" 'Trail': 'State_Of_Match',\n",
|
761 |
+
" 'Ball_Move': 'Motion',\n",
|
762 |
+
" 'Defeat': 'Match',\n",
|
763 |
+
" 'Dissent': 'Foul',\n",
|
764 |
+
" 'Follow_Up': 'Shot',\n",
|
765 |
+
" 'Score': 'State_Of_Match',\n",
|
766 |
+
" 'Draw': 'Match',\n",
|
767 |
+
" 'Pass_Back': 'Pass',\n",
|
768 |
+
" 'Simulation': 'Foul',\n",
|
769 |
+
" 'Miss_Goal': 'Shot',\n",
|
770 |
+
" 'Miss_Chance': 'Chance',\n",
|
771 |
+
" 'Flick_On': 'Pass',\n",
|
772 |
+
" 'Ball_Escape': 'Motion',\n",
|
773 |
+
" 'Give_Card': 'Foul',\n",
|
774 |
+
" 'Take_On': 'One_On_One',\n",
|
775 |
+
" 'Connect': 'Pass',\n",
|
776 |
+
" 'Goalkeeper_Advance': 'Motion',\n",
|
777 |
+
" 'Hit': 'Shot',\n",
|
778 |
+
" 'Advantage': 'Foul',\n",
|
779 |
+
" 'Feign': 'Shot',\n",
|
780 |
+
" 'Overcome_Goalkeeper': 'Goal',\n",
|
781 |
+
" 'Prepare_Goal': 'Goal',\n",
|
782 |
+
" 'Ball': 'Actors',\n",
|
783 |
+
" 'Spectator_Activity': 'State_Of_Match',\n",
|
784 |
+
" 'Goal_Target': 'Field',\n",
|
785 |
+
" 'Player': 'Actors',\n",
|
786 |
+
" 'Referee': 'Actors',\n",
|
787 |
+
" 'Field': 'Field',\n",
|
788 |
+
" 'Team': 'Actors',\n",
|
789 |
+
" 'Bench': 'Field',\n",
|
790 |
+
" 'Coach': 'Actors',\n",
|
791 |
+
" 'Concede_Compensation': 'Foul',\n",
|
792 |
+
" 'Match_Temporal_Subdivision': 'Match',\n",
|
793 |
+
" 'Confusion': 'Mix-up',\n",
|
794 |
+
" 'Score_Goal': 'Goal',\n",
|
795 |
+
" 'Celebrate_Goal': 'Goal',\n",
|
796 |
+
" 'Suspension': 'Lineup',\n",
|
797 |
+
" 'Spectators': 'Actors',\n",
|
798 |
+
" 'Competition_Stage': 'Competition',\n",
|
799 |
+
" 'Body_Parts': 'Actors',\n",
|
800 |
+
" 'Trick': 'One_On_One',\n",
|
801 |
+
" 'Competition': 'Competition',\n",
|
802 |
+
" 'Stadium': 'Field',\n",
|
803 |
+
" 'Match_Quality': 'State_Of_Match',\n",
|
804 |
+
" 'Ball_And_Goal': 'Shot',\n",
|
805 |
+
" 'Equipment': 'Actors',\n",
|
806 |
+
" 'Injuries': 'Foul',\n",
|
807 |
+
" '': 'Pass',\n",
|
808 |
+
" 'Shot_Quality': 'Shot'}"
|
809 |
+
]
|
810 |
+
},
|
811 |
+
"execution_count": 76,
|
812 |
+
"metadata": {},
|
813 |
+
"output_type": "execute_result"
|
814 |
+
}
|
815 |
+
],
|
816 |
+
"source": [
|
817 |
+
"from lxml import etree as ET\n",
|
818 |
+
"kicktionary = ET.parse(\"kicktionary_lu_info.xml\")\n",
|
819 |
+
"frame_to_scenario = {\n",
|
820 |
+
" lu.attrib[\"frame\"]: lu.attrib[\"scenario\"]\n",
|
821 |
+
" for lu in kicktionary.xpath(\".//LEXICAL-UNIT\") if lu.attrib[\"frame\"]\n",
|
822 |
+
"}\n",
|
823 |
+
"frame_to_scenario"
|
824 |
+
]
|
825 |
+
}
|
826 |
+
],
|
827 |
+
"metadata": {
|
828 |
+
"interpreter": {
|
829 |
+
"hash": "1c3e697aa4e6ae3f4f7b554c053a671f50a0156c07fd90d57948174b29e29a61"
|
830 |
+
},
|
831 |
+
"kernelspec": {
|
832 |
+
"display_name": "Python 3.9.7 ('perspredict')",
|
833 |
+
"language": "python",
|
834 |
+
"name": "python3"
|
835 |
+
},
|
836 |
+
"language_info": {
|
837 |
+
"codemirror_mode": {
|
838 |
+
"name": "ipython",
|
839 |
+
"version": 3
|
840 |
+
},
|
841 |
+
"file_extension": ".py",
|
842 |
+
"mimetype": "text/x-python",
|
843 |
+
"name": "python",
|
844 |
+
"nbconvert_exporter": "python",
|
845 |
+
"pygments_lexer": "ipython3",
|
846 |
+
"version": "3.9.7"
|
847 |
+
},
|
848 |
+
"orig_nbformat": 4
|
849 |
+
},
|
850 |
+
"nbformat": 4,
|
851 |
+
"nbformat_minor": 2
|
852 |
+
}
|