adherent commited on
Commit
44a9d55
1 Parent(s): 6c25ddb
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. Bart-gen-arg +1 -0
  2. TEST/ttest2.py +246 -0
  3. TEST/ytest.py +265 -0
  4. aida_ontology_fj-5.csv +593 -0
  5. aida_ontology_new.csv +0 -150
  6. git_token.txt +1 -0
  7. head_templates_preprocessed_data/test.jsonl +3 -0
  8. head_templates_preprocessed_data/train.jsonl +3 -0
  9. head_templates_preprocessed_data/val.jsonl +3 -0
  10. head_templates_preprocessed_data1/test.jsonl +3 -0
  11. head_templates_preprocessed_data1/train.jsonl +3 -0
  12. head_templates_preprocessed_data1/val.jsonl +3 -0
  13. head_templates_preprocessed_data_new/temp/test.jsonl +3 -0
  14. head_templates_preprocessed_data_new/temp/train.jsonl +3 -0
  15. head_templates_preprocessed_data_new/temp/val.jsonl +3 -0
  16. head_templates_preprocessed_data_new/temp1/test.jsonl +3 -0
  17. head_templates_preprocessed_data_new/temp1/train.jsonl +3 -0
  18. head_templates_preprocessed_data_new/temp1/val.jsonl +3 -0
  19. head_templates_preprocessed_data_new/test.jsonl +3 -0
  20. head_templates_preprocessed_data_new/train.jsonl +3 -0
  21. head_templates_preprocessed_data_new/val.jsonl +3 -0
  22. head_templates_preprocessed_data_test/test.jsonl +3 -0
  23. head_templates_preprocessed_data_test/train.jsonl +3 -0
  24. head_templates_preprocessed_data_test/val.jsonl +3 -0
  25. head_what_preprocessed_data/test.jsonl +3 -0
  26. head_what_preprocessed_data/train.jsonl +3 -0
  27. head_what_preprocessed_data/val.jsonl +3 -0
  28. span_preprocessed_data/test.jsonl +3 -0
  29. span_preprocessed_data/train.jsonl +3 -0
  30. span_preprocessed_data/val.jsonl +3 -0
  31. span_templates_preprocessed_data1/test.jsonl +3 -0
  32. span_templates_preprocessed_data1/train.jsonl +3 -0
  33. span_templates_preprocessed_data1/val.jsonl +3 -0
  34. span_what_preprocessed_data/test.jsonl +3 -0
  35. span_what_preprocessed_data/train.jsonl +3 -0
  36. span_what_preprocessed_data/val.jsonl +3 -0
  37. src/genie/.data_module3.py.swp +0 -0
  38. src/genie/convert_gen_to_output5.py +221 -0
  39. src/genie/data_module4.py +245 -0
  40. src/genie/data_module_w.py +255 -0
  41. src/genie/question/convert_gen_to_output2.py +172 -0
  42. src/genie/question/convert_gen_to_output4.py +172 -0
  43. src/genie/{data_module.py → question/data_module.py} +7 -7
  44. src/genie/{data_module1.py → question/data_module1.py} +7 -6
  45. src/genie/question/data_module2.py +282 -0
  46. src/genie/question/data_module3.py +285 -0
  47. src/genie/{convert_gen_to_output.py → temp/convert_gen_to_output.py} +0 -0
  48. src/genie/{convert_gen_to_output1.py → temp/convert_gen_to_output1.py} +0 -0
  49. src/genie/! +221 -0
  50. test_rams.sh +4 -4
Bart-gen-arg ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit 26debc5ccc7a55a0186cc440e4eb824f7eb66b0c
TEST/ttest2.py ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import re
3
+ import spacy
4
+ from tqdm import tqdm
5
+
6
+ from src.genie.utils import WhitespaceTokenizer
7
+
8
+ #x = 0
9
+ def find_head(arg_start, arg_end, doc):
10
+ # 设置一个临时变量 存储 论元短语的开始索引 cur_i = arg_start
11
+ cur_i = arg_start
12
+ # 进行遍历
13
+ while doc[cur_i].head.i >= arg_start and doc[cur_i].head.i <= arg_end:
14
+ if doc[cur_i].head.i == cur_i:
15
+ # self is the head
16
+ break
17
+ else:
18
+ cur_i = doc[cur_i].head.i
19
+
20
+ arg_head = cur_i
21
+
22
+ return (arg_head, arg_head)
23
+
24
+ def find_arg_span(arg, context_words, trigger_start, trigger_end, head_only=False, doc=None):
25
+ # 要定义一个match 作为匹配项
26
+ match = None
27
+ # arg 是论元短语 是预测文件中predicted中生成的论元短语 arg_len目前的含义是获取生成论元短语的长度
28
+ arg_len = len(arg)
29
+ # context_words 是文本 min_dis是最短距离
30
+ min_dis = len(context_words) # minimum distance to trigger
31
+ #print(arg)
32
+
33
+ #x = 0
34
+ # i 代表文本中的单词索引 w 代表文本中的i索引对应的单词
35
+ for i, w in enumerate(context_words):
36
+ # 如果文本单词列表中有一段单词 和 模型生成的单词是相等的
37
+ if context_words[i:i + arg_len] == arg:
38
+ # 如果 这个论元单词的开始索引在触发词单词索引之前
39
+ # global x += 1
40
+ # print('aa')
41
+ if i < trigger_start:
42
+ # 那么距离就是 触发词单词的开始索引减去论元短语的开始索引再减去论元短语的长度
43
+ dis = abs(trigger_start - i - arg_len)
44
+ else:
45
+ # 反之
46
+ dis = abs(i - trigger_end)
47
+ if dis < min_dis:
48
+ # match是一个元组
49
+ match = (i, i + arg_len - 1)
50
+ min_dis = dis
51
+
52
+ #print(match)
53
+ if match and head_only:
54
+ assert (doc != None)
55
+ match = find_head(match[0], match[1], doc)
56
+ #print(x)
57
+ return match
58
+
59
+ def get_event_type(ex):
60
+ evt_type = []
61
+ for evt in ex['evt_triggers']:
62
+ for t in evt[2]:
63
+ evt_type.append(t[0])
64
+ return evt_type
65
+
66
+ def extract_args_from_template(ex, template, ontology_dict,):
67
+ # extract argument text
68
+ # 这个函数的返回值是一个字典 因此需要 template列表和ex中的predicted列表同时进行遍历放入字典中
69
+ # 在这里定义两个列表 分别存放 定义存放模板的列表 TEMPLATE 和 相对应的生成 PREDICTED
70
+ # 传过来的参数中的template就是包含所有模板的列表 因此不需要再定义TEMPLATE 还是需要定义一个存放分词后的template
71
+ # 这里的template是相应事件类型下的模板包含多个
72
+ # 原来处理的方式是一个数据和一个综合性模板 现在模板是分开的 为什么要把template传过来 这不是脱裤子放屁的操作?
73
+ # 下面这段操作是因为上次模板的定义是相同因此只需要去列表中的第一个模板就行 这次需要用循环进行遍历
74
+ # print(ex)
75
+ t = []
76
+ TEMPLATE = []
77
+ for i in template:
78
+ t = i.strip().split()
79
+ TEMPLATE.append(t)
80
+ t = []
81
+ # 到此为止 得到存放该ex即该数据类型下的所有模板的分词后的列表存储 下面获取对应的predicted同理
82
+ PREDICTED = []
83
+ p = []
84
+ # 形参中插入的ex应该包含了该条数据(即该事件类型下)所有应该生成的论元对应的模板
85
+ # 在程序中出现了不一样的情况 貌似只有一条模板数据 这个问题解决了
86
+ # print(ex['predicted'])
87
+ for i in ex['predicted']:
88
+ p = i.strip().split()
89
+ PREDICTED.append(p)
90
+ p = []
91
+ # print(TEMPLATE)
92
+ # print(PREDICTED)
93
+ # 这个字典变量定义了这个函数的返回值 应该是论元角色-论元短语的key-value映射
94
+ predicted_args = {}
95
+ evt_type = get_event_type(ex)[0]
96
+ # print(evt_type)
97
+ # 不出意外的话 TEMPLATE和PREDICTED的长度应该是相等的
98
+ length = len(TEMPLATE)
99
+ for i in range(length):
100
+ #if i < 4:
101
+ #continue
102
+ template_words = TEMPLATE[i]
103
+ predicted_words = PREDICTED[i]
104
+ t_ptr = 0
105
+ p_ptr = 0
106
+ print(template_words)
107
+ print(predicted_words)
108
+ while t_ptr < len(template_words) and p_ptr < len(predicted_words):
109
+ if re.match(r'<(arg\d+)>', template_words[t_ptr]):
110
+ # print('aa')
111
+ m = re.match(r'<(arg\d+)>', template_words[t_ptr])
112
+ # 这一步的操作是从模板中得到 <arg1> 这样的词符 即arg_num 然后通过arg_num找到对应论元角色arg_name
113
+ arg_num = m.group(1)
114
+ # print(arg_num)
115
+ arg_name = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_num]
116
+
117
+ if predicted_words[p_ptr] == '<arg>':
118
+ # missing argument
119
+ p_ptr +=1
120
+ t_ptr +=1
121
+ else:
122
+ arg_start = p_ptr
123
+ if t_ptr + 1 == len(template_words):
124
+ while (p_ptr < len(predicted_words)):
125
+ p_ptr += 1
126
+ else:
127
+ while (p_ptr < len(predicted_words)) and (predicted_words[p_ptr] != template_words[t_ptr+1]):
128
+ p_ptr += 1
129
+ arg_text = predicted_words[arg_start:p_ptr]
130
+ predicted_args[arg_name] = arg_text
131
+ t_ptr += 1
132
+ # aligned
133
+ else:
134
+ t_ptr += 1
135
+ p_ptr += 1
136
+
137
+ # print(predicted_args)
138
+ return predicted_args
139
+
140
+ def pro():
141
+ nlp = spacy.load('en_core_web_sm')
142
+ nlp.tokenizer = WhitespaceTokenizer(nlp.vocab)
143
+ ontology_dict = {}
144
+ with open('./aida_ontology_fj-5.csv', 'r') as f:
145
+ for lidx, line in enumerate(f):
146
+ if lidx == 0: # header
147
+ continue
148
+ fields = line.strip().split(',')
149
+ if len(fields) < 2:
150
+ break
151
+ evt_type = fields[0]
152
+ if evt_type in ontology_dict.keys():
153
+ arguments = fields[2:]
154
+ ontology_dict[evt_type]['template'].append(fields[1])
155
+ for i, arg in enumerate(arguments):
156
+ if arg != '':
157
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
158
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
159
+ else:
160
+ ontology_dict[evt_type] = {}
161
+ arguments = fields[2:]
162
+ ontology_dict[evt_type]['template'] = []
163
+ ontology_dict[evt_type]['template'].append(fields[1])
164
+ for i, arg in enumerate(arguments):
165
+ if arg != '':
166
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
167
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
168
+
169
+ examples = {}
170
+ x = 0
171
+ with open('./data/RAMS_1.0/data/test_head_coref.jsonlines', 'r') as f:
172
+ for line in f:
173
+ x += 1
174
+ ex = json.loads(line.strip())
175
+ ex['ref_evt_links'] = ex['gold_evt_links']
176
+ ex['gold_evt_links'] = []
177
+ examples[ex['doc_key']] = ex
178
+
179
+ flag = {}
180
+ y = 0
181
+ with open('./checkpoints/gen-RAMS-pred/predictions.jsonl', 'r') as f:
182
+ for line in f:
183
+ y += 1
184
+ pred = json.loads(line.strip())
185
+ # print(pred['predicted'])
186
+ if pred['doc_key'] in flag.keys():
187
+ examples[pred['doc_key']]['predicted'].append(pred['predicted'])
188
+ examples[pred['doc_key']]['gold'].append(pred['gold'])
189
+ # 如果没有 说明这是新的事件类型
190
+ else:
191
+ flag[pred['doc_key']] = True
192
+ examples[pred['doc_key']]['predicted'] = []
193
+ examples[pred['doc_key']]['gold'] = []
194
+ # 然后将此条数据存入
195
+ examples[pred['doc_key']]['predicted'].append(pred['predicted'])
196
+ examples[pred['doc_key']]['gold'].append(pred['gold'])
197
+ # print(len(examples), x, y) 871 871 3614
198
+
199
+ for ex in tqdm(examples.values()):
200
+ if 'predicted' not in ex:# this is used for testing
201
+ continue
202
+ # print(ex)
203
+ # break
204
+ # print(ex)
205
+ # get template 获取事件类型
206
+ # print('nw_RC00c8620ef5810429342a1c339e6c76c1b0b9add3f6010f04482fd832')
207
+ evt_type = get_event_type(ex)[0]
208
+ context_words = [w for sent in ex['sentences'] for w in sent]
209
+ # 这里的template是ontology_dict中 template 包含一个事件类型下的所有事件模板
210
+ template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
211
+ # extract argument text
212
+ # 这里应该是提取预测文件中预测到的论元短语 ex是一条json数据 template是这条json数据对应下的模板 on是论元角色和<arg1>的映射
213
+ # 这里ex中的predicted和gold已经包括了该事件类型下的所有论元 用列表的形式进行存储 且顺序是一一对应的
214
+ # 这里返回的predicted_args是一个字典:
215
+ # ex = {'predicted': [' A man attacked target using something at place in order to take something', ' Attacker attacked EgyptAir plane using something at place in order to take something', ' Attacker attacked target using a suicide belt at place in order to take something', ' Attacker attacked target using something at Flight 181 place in order to take something', ' Attacker attacked target using something at place in order to take EgyptAir Flight 181']}
216
+ # template = ontology_dict['conflict.attack.stealrobhijack']['template']
217
+ # print(ex)
218
+ predicted_args = extract_args_from_template(ex, template, ontology_dict)
219
+ # print(predicted_args)
220
+ # break
221
+ trigger_start = ex['evt_triggers'][0][0]
222
+ trigger_end = ex['evt_triggers'][0][1]
223
+ # 上面返回的predicted_args是一个字典 暂时认为是论元角色和具体论元短语的映射
224
+ # 还没有发现doc的作用
225
+ doc = None
226
+ # 通过test_rams.sh文件的设置 可以发现args.head_only的值为true
227
+ head_only = True
228
+ if head_only:
229
+ # # 从原始文本中取出标记
230
+ doc = nlp(' '.join(context_words))
231
+ for argname in predicted_args:
232
+ # 通过find_arg_span函数找出
233
+ arg_span = find_arg_span(predicted_args[argname], context_words,
234
+ trigger_start, trigger_end, head_only=True, doc=doc)
235
+ # print()
236
+ #print(arg_span)
237
+ pro()
238
+ #print(x)
239
+
240
+ # dict = {'A': 1, 'B': 2, 'C': 3}
241
+ #
242
+ # for x in dict:
243
+ # print(x)
244
+ # if '1' in dict.keys():
245
+ # print('aaaaaaaa')
246
+
TEST/ytest.py ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ from copy import deepcopy
3
+ import transformers
4
+ from transformers import BartTokenizer
5
+ import jsonlines
6
+ import json
7
+
8
+
9
+ # dict = {"rel_triggers": [], "gold_rel_links": [], "doc_key": "nw_RC00c8620ef5810429342a1c339e6c76c1b0b9add3f6010f04482fd832", "ent_spans": [[27, 27, [["evt043arg01communicator", 1.0]]], [48, 48, [["evt043arg03place", 1.0]]], [32, 36, [["evt043arg02recipient", 1.0]]]], "language_id": "eng", "source_url": "http://bbc.co.uk/sport/athletics/36295481", "evt_triggers": [[31, 31, [["contact.prevarication.broadcast", 1.0]]]], "split": "test", "sentences": [["We", "are", "ashamed", "of", "them", ".", "\""], ["However", ",", "Mutko", "stopped", "short", "of", "admitting", "the", "doping", "scandal", "was", "state", "sponsored", "."], ["\"", "We", "are", "very", "sorry", "that", "athletes", "who", "tried", "to", "deceive", "us", ",", "and", "the", "world", ",", "were", "not", "caught", "sooner", "."], ["We", "are", "very", "sorry", "because", "Russia", "is", "committed", "to", "upholding", "the", "highest", "standards", "in", "sport", "and", "is", "opposed", "to", "anything", "that", "threatens", "the", "Olympic", "values", ",", "\"", "he", "said", "."], ["English", "former", "heptathlete", "and", "Athens", "2004", "bronze", "medallist", "Kelly", "Sotherton", "was", "unhappy", "with", "Mutko", "'s", "plea", "for", "Russia", "'s", "ban", "to", "be", "lifted", "for", "Rio"]], "gold_evt_links": [[[31, 31], [27, 27], "evt043arg01communicator"], [[31, 31], [32, 32], "evt043arg02recipient"], [[31, 31], [48, 48], "evt043arg03place"]], "clusters": [[[0, 0], [22, 22], [32, 32], [43, 43], [48, 48], [90, 91]], [[9, 9], [70, 70], [86, 87]]], "corefs": [[[0, 0], [22, 22], [32, 32], [43, 43], [48, 48], [90, 90]], [[9, 9], [70, 70], [86, 86]]]}
10
+ #
11
+ # template = "what is the <arg>"
12
+ #
13
+ # context_words = [w for sent in dict['sentences'] for w in sent]
14
+ #
15
+ # argtext = context_words[27]
16
+ #
17
+ # print(argtext)
18
+ #
19
+ # template = re.sub('<arg>', argtext, template)
20
+ #
21
+ # print(template)
22
+
23
+ # for lidx, triple in enumerate(dict['gold_evt_links']):
24
+ # # 触发词 论元 论元
25
+ # # 例子: "gold_evt_links":
26
+ # # [[[40, 40], [33, 33], "evt089arg01victim"],
27
+ # # [[40, 40], [28, 28], "evt089arg02place"]]
28
+ # trigger_span, argument_span, arg_name = triple
29
+ # # 第几个论元
30
+ # arg_num = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_name]
31
+ # # 具体论元内容 短语
32
+ # arg_text = ' '.join(context_words[argument_span[0]:argument_span[1] + 1])
33
+ # # 通过正则表达式的方式将模板中的每个<arg> 替换为具体的论元内容
34
+ # # 按照顺序将列表中的<arg>依次替换为
35
+ # template[lidx] = re.sub('<{}>'.format(arg_num), arg_text, template[lidx])
36
+ # # "ent_spans": [[27, 27, [["evt043arg01communicator", 1.0]]],
37
+ # # [48, 48, [["evt043arg03place", 1.0]]],
38
+ # # [32, 36, [["evt043arg02recipient", 1.0]]]]
39
+ # context_words = [w for sent in dict['sentences'] for w in sent]
40
+ #
41
+ # print(context_words[32])
42
+ # print(context_words[33])
43
+ # print(context_words[34])
44
+ # print(context_words[35])
45
+ # print(context_words[36])
46
+
47
+ def get_event_type(ex):
48
+ evt_type = []
49
+ for evt in ex['evt_triggers']:
50
+ for t in evt[2]:
51
+ evt_type.append(t[0])
52
+ return evt_type
53
+
54
+ def create_gold_gen(ex, ontology_dict, mark_trigger=True):
55
+ # 设置三个总列表、存放输入模板、输出模板
56
+ # 设置三个总列表、存放输入模板、输出模板
57
+ INPUT = []
58
+ OUTPUT = []
59
+ CONTEXT = []
60
+ evt_type = get_event_type(ex)[0]
61
+ context_words = [w for sent in ex['sentences'] for w in sent]
62
+ # print(context_words[48])
63
+ input_template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
64
+ i = len(input_template)
65
+ input_list = []
66
+ for x in range(i):
67
+ str = re.sub(r'<arg\d>', '<arg>', input_template[x])
68
+ input_list.append(str)
69
+ # 其中input_list种存放的是 原始数据中<arg1> 全部替换为 <arg> 之后的模板 下一步应该进行分词
70
+ # temp = []
71
+ for x in range(i):
72
+ space_tokenized_template = input_list[x].split(' ')
73
+ INPUT.append(space_tokenized_template)
74
+ space_tokenized_template = []
75
+ # 其中temp中存放的都是分词后的模板 下一步对temp中的所有元素进行tokenize
76
+ tokenized_input_template = []
77
+ tokenizer = BartTokenizer.from_pretrained('facebook/bart-large')
78
+ temp = []
79
+ for x in range(len(INPUT)):
80
+ for w in INPUT[x]:
81
+ tokenized_input_template.extend(tokenizer.tokenize(w, add_prefix_space=True))
82
+
83
+ # print(tokenized_input_template)
84
+
85
+ temp.append(tokenized_input_template)
86
+ tokenized_input_template = []
87
+ print(temp)
88
+ break
89
+ template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
90
+
91
+ # if ex['doc_key'] == 'nw_RC04992035300b2ec94d8692646a28dc8b5f210c94842d20834c5342df':
92
+ # print('bbb')
93
+ # ['<arg1> was injured by injurer with medical issue at place',
94
+ # 'Victim was injured by <arg2> with medical issue at place',
95
+ # 'Victim was injured by injurer with medical issue at <arg3> place',
96
+ # 'Victim was injured by injurer with <arg4> medical issue at place']
97
+ # print(template)
98
+ for lidx, triple in enumerate(ex['gold_evt_links']):
99
+ # 触发词 论元 论元
100
+ # 例子: "gold_evt_links":
101
+ # [[50, 50], [48, 48], 'evt092arg01victim']
102
+ # [[50, 50], [7, 7], 'evt092arg03place']
103
+
104
+ trigger_span, argument_span, arg_name = triple
105
+ if ex['doc_key'] == 'nw_RC013c8e78b7e8a4fb22193483877058f712dfd8b75b7a06d950de0b8f':
106
+ print(len(ex['gold_evt_links']))
107
+ # 第几个论元
108
+ arg_num = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_name]
109
+ # 具体论元内容 短语
110
+ arg_text = ' '.join(context_words[argument_span[0]:argument_span[1] + 1])
111
+ # if ex['doc_key'] == 'nw_RC04992035300b2ec94d8692646a28dc8b5f210c94842d20834c5342df':
112
+ # print(arg_num)
113
+ # print(arg_text)
114
+ # print(arg_text)
115
+ # 通过正则表达式的方式将模板中的每个<arg> 替换为具体的论元内容
116
+ # 搜索templat中的arg_num 找到对应的序列
117
+ # INDEX = 0
118
+ for index in range(len(template)):
119
+ if arg_num in template[index]:
120
+ break
121
+ else:
122
+ continue
123
+ # INDEX += 1
124
+ template[index] = re.sub('<{}>'.format(arg_num), arg_text, template[index])
125
+ if ex['doc_key'] == 'nw_RC013c8e78b7e8a4fb22193483877058f712dfd8b75b7a06d950de0b8f':
126
+ print('aaa')
127
+ print(template)
128
+ trigger = ex['evt_triggers'][0]
129
+
130
+ # 将context放入CONTEXT中
131
+ for w in range(i):
132
+ CONTEXT.append(context_words)
133
+ output_template = []
134
+ # 此时的template中已经全部替换为论元短语 这部是将<arg1> 替换为<arg>
135
+ for i in range(len(template)):
136
+ output_template.append(re.sub(r'<arg\d>', '<arg>', template[i]))
137
+ # spaceout_tokenized_template = []
138
+ for i in range(len(output_template)):
139
+ OUTPUT.append(output_template[i].split(' '))
140
+
141
+ # tokenized_out_template = []
142
+ # for i in range(len(spaceout_tokenized_template)):
143
+ # for w in spaceout_tokenized_template[i]:
144
+ # tokenized_out_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
145
+ # OUTPUT.append(tokenized_out_template)
146
+ # tokenized_out_template = []
147
+
148
+ return INPUT, OUTPUT, CONTEXT
149
+
150
+
151
+ def load_ontology():
152
+ ontology_dict = {}
153
+ with open('aida_ontology_fj-5.csv', 'r') as f:
154
+ for lidx, line in enumerate(f):
155
+ if lidx == 0: # header
156
+ continue
157
+ fields = line.strip().split(',')
158
+ if len(fields) < 2:
159
+ break
160
+ evt_type = fields[0]
161
+ if evt_type in ontology_dict.keys():
162
+ # 得到该事件类型下的所有论元类型
163
+ args = fields[2:]
164
+ # 将该事件类型对应的模板中的论元模板 填充到onto_logy字典中
165
+ ontology_dict[evt_type]['template'].append(fields[1])
166
+ for i, arg in enumerate(args):
167
+ if arg != '':
168
+ # 事件类型下添加字典一项 arg1的值为arg
169
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
170
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
171
+ # 即扫描到的事件类型在 evt_type_dict.keys() 还未存在过
172
+ else:
173
+ # 建立该事件类型的key
174
+ ontology_dict[evt_type] = {}
175
+ args = fields[2:]
176
+ ontology_dict[evt_type]['template'] = []
177
+ ontology_dict[evt_type]['template'].append(fields[1])
178
+ for i, arg in enumerate(args):
179
+ if arg != '':
180
+ # 事件类型下添加字典一项 arg1的值为arg
181
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
182
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
183
+
184
+ return ontology_dict
185
+
186
+ def prepare_data():
187
+
188
+ ontology_dict = load_ontology()
189
+ # ('train', './data/RAMS_1.0/data/train.jsonlines'),
190
+ # ('test', './data/RAMS_1.0/data/test_head_coref.jsonlines')
191
+ for split, f in [('val', './data/RAMS_1.0/data/dev.jsonlines'),('train', './data/RAMS_1.0/data/train.jsonlines'),
192
+ ('test', './data/RAMS_1.0/data/test_head_coref.jsonlines')]:
193
+ # , open('head_templates_preprocessed_data/{}.jsonl'.format(split), 'w') as writer
194
+ with open(f, 'r') as reader:
195
+
196
+ # print(ontology_dict['contact.prevarication.broadcast'])
197
+ for lidx, line in enumerate(reader):
198
+ ex = json.loads(line.strip())
199
+ # print(lidx)
200
+ # print(ex)
201
+ event_type = get_event_type(ex)[0]
202
+ if ex['doc_key'] == 'nw_RC013c8e78b7e8a4fb22193483877058f712dfd8b75b7a06d950de0b8f':
203
+ # {'rel_triggers': [], 'gold_rel_links': [],
204
+ # 'doc_key': 'nw_RC04992035300b2ec94d8692646a28dc8b5f210c94842d20834c5342df',
205
+ # 'ent_spans': [[48, 48, [['evt092arg01victim', 1.0]]], [7, 7, [['evt092arg03place', 1.0]]]],
206
+ # 'language_id': 'eng',
207
+ # 'source_url': 'http://news.sky.com/story/attack-in-nice-truck-ploughes-into-crowd-10502068',
208
+ # 'evt_triggers': [[50, 50, [['life.injure.n/a', 1.0]]]], 'split': 'test',
209
+ # 'sentences': [[':', ':', 'History', 'Of', 'Deadly', 'Attacks', 'In', 'France'],
210
+ # ['One', ',', 'Laurence', 'Olding', ',', 'was', 'with', 'his', 'fiance', 'and',
211
+ # 'jumped', 'over', 'a', 'promenade', 'wall', 'onto', 'the', 'concrete', 'below',
212
+ # 'to', 'avoid', 'the', 'truck', '.'],
213
+ # ['Emerging', 'from', 'hospital', 'in', 'bandages', 'he', 'said', ':', '"', 'There',
214
+ # 'was', 'debris', 'in', 'the', 'streets', ',', 'people', 'lying', 'injured', 'or',
215
+ # 'dead', 'in', 'the', 'road', '.', '"'],
216
+ # ['Video', ':', 'Hollande', 'On', "'", 'Horror', "'", 'Of', 'Attack'],
217
+ # ['Two', 'Americans', '-', 'Sean', 'Copeland', 'and', 'his', '11-year', '-', 'old',
218
+ # 'son', 'Brodie', 'from', 'Texas', '-', 'have', 'been', 'confirmed', 'among', 'the',
219
+ # 'dead', ',', 'a', 'US', 'official', 'said', '.']],
220
+ # 'gold_evt_links': [[[50, 50], [48, 48], 'evt092arg01victim'],
221
+ # [[50, 50], [7, 7], 'evt092arg03place']],
222
+ # 'clusters': [[[10, 11], [15, 15], [37, 37]], [[70, 71], [73, 73]]],
223
+ # 'corefs': [[[11, 11], [15, 15], [37, 37]], [[71, 71], [73, 73]]]}
224
+ print(ex)
225
+ # {'template': ['<arg1> was injured by injurer with medical issue at place',
226
+ # 'Victim was injured by <arg2> with medical issue at place',
227
+ # 'Victim was injured by injurer with medical issue at <arg3> place',
228
+ # 'Victim was injured by injurer with <arg4> medical issue at place'],
229
+ # 'arg1': 'evt092arg01victim', 'evt092arg01victim': 'arg1', 'arg2': 'evt092arg02injurer',
230
+ # 'evt092arg02injurer': 'arg2', 'arg3': 'evt092arg03place', 'evt092arg03place': 'arg3',
231
+ # 'arg4': 'evt092arg04medicalissue', 'evt092arg04medicalissue': 'arg4'}
232
+ print(ontology_dict[event_type.replace('n/a','unspecified')])
233
+ input_template, output_template, context = create_gold_gen(ex, ontology_dict,
234
+ True)
235
+ ontology_dict = load_ontology()
236
+ if ex['doc_key'] == 'nw_RC013c8e78b7e8a4fb22193483877058f712dfd8b75b7a06d950de0b8f':
237
+ # [['<arg>', 'was', 'injured', 'by', 'injurer', 'with', 'medical', 'issue', 'at', 'place'],
238
+ # ['Victim', 'was', 'injured', 'by', '<arg>', 'with', 'medical', 'issue', 'at', 'place'],
239
+ # ['Victim', 'was', 'injured', 'by', 'injurer', 'with', 'medical', 'issue', 'at', '<arg>', 'place'],
240
+ # ['Victim', 'was', 'injured', 'by', 'injurer', 'with', '<arg>', 'medical', 'issue', 'at', 'place']]
241
+ print(input_template)
242
+ # [['people', 'was', 'injured', 'by', 'injurer', 'with', 'medical', 'issue', 'at', 'place'],
243
+ # ['Victim', 'was', 'injured', 'by', '<arg>', 'with', 'medical', 'issue', 'at', 'place'],
244
+ # ['Victim', 'was', 'injured', 'by', 'injurer', 'with', 'medical', 'issue', 'at', '<arg>', 'place'],
245
+ # ['Victim', 'was', 'injured', 'by', 'injurer', 'with', '<arg>', 'medical', 'issue', 'at', 'place']]
246
+ print(output_template)
247
+ # print(input_template)
248
+ # 4 4 4
249
+ # print(len(input_template))
250
+ # print(len(output_template))
251
+ # print(len(context))
252
+ [[':', ':', 'History', 'Of', 'Deadly', 'Attacks', 'In', 'France'],
253
+ ['One', ',', 'Laurence', 'Olding', ',', 'was', 'with', 'his', 'fiance', 'and', 'jumped', 'over', 'a', 'promenade', 'wall', 'onto', 'the', 'concrete', 'below', 'to', 'avoid', 'the', 'truck', '.'],
254
+ ['Emerging', 'from', 'hospital', 'in', 'bandages', 'he', 'said', ':', '"', 'There', 'was', 'debris', 'in', 'the', 'streets', ',', 'people', 'lying', 'injured', 'or', 'dead', 'in', 'the', 'road', '.', '"'],
255
+ ['Video', ':', 'Hollande', 'On', "'", 'Horror', "'", 'Of', 'Attack'],
256
+ ['Two', 'Americans', '-', 'Sean', 'Copeland', 'and', 'his', '11-year', '-', 'old', 'son', 'Brodie', 'from', 'Texas', '-', 'have', 'been', 'confirmed', 'among', 'the', 'dead', ',', 'a', 'US', 'official', 'said', '.']]
257
+
258
+ [':', ':', 'History', 'Of', 'Deadly', 'Attacks', 'In', 'France',
259
+
260
+ 'One', ',', 'Laurence', 'Olding', ',', 'was', 'with', 'his', 'fiance', 'and', 'jumped', 'over', 'a', 'promenade', 'wall', 'onto', 'the', 'concrete', 'below', 'to', 'avoid', 'the', 'truck', '.',
261
+ 'Emerging', 'from', 'hospital', 'in', 'bandages', 'he', 'said', ':', '"', 'There', 'was', 'debris', 'in', 'the', 'streets', ',', 'people', 'lying', 'injured', 'or', 'dead', 'in', 'the', 'road', '.', '"',
262
+ 'Video', ':', 'Hollande', 'On', "'", 'Horror', "'", 'Of', 'Attack',
263
+ 'Two', 'Americans', '-', 'Sean', 'Copeland', 'and', 'his', '11-year', '-', 'old', 'son', 'Brodie', 'from', 'Texas', '-', 'have', 'been', 'confirmed', 'among', 'the', 'dead', ',', 'a', 'US', 'official', 'said', '.']
264
+
265
+ prepare_data()
aida_ontology_fj-5.csv ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ event_type,template,arg1,arg2,arg3,arg4,arg5
2
+ artifactexistence.artifactfailure.mechanicalfailure,<arg1> mechanical artifact failed due to instrument at <arg3> place,evt152arg01mechanicalartifact,,,,
3
+ artifactexistence.artifactfailure.mechanicalfailure,Mechanical artifact failed due to <arg2> instrument at place,,evt152arg02instrument,,,
4
+ artifactexistence.artifactfailure.mechanicalfailure,Mechanical artifact failed due to instrument at <arg3> place,,,evt152arg03place,,
5
+ artifactexistence.damagedestroy.unspecified,<arg1> damaged or destroyed something using instrument in place,evt001arg01damagerdestroyer,,,,
6
+ artifactexistence.damagedestroy.unspecified,Damager damaged or destroyed <arg2> using instrument in place,,evt001arg02artifact,,,
7
+ artifactexistence.damagedestroy.unspecified,Damager damaged or destroyed something using <arg3> instrument in place,,,evt001arg03instrument,,
8
+ artifactexistence.damagedestroy.unspecified,Damager damaged or destroyed something using instrument in <arg4> place,,,,evt001arg04place,
9
+ artifactexistence.damagedestroy.damage,<arg1> damaged something using instrument in place,evt002arg01damager,,,,
10
+ artifactexistence.damagedestroy.damage,Damager damaged <arg2> using instrument in place,,evt002arg02artifact,,,
11
+ artifactexistence.damagedestroy.damage,Damager damaged something using <arg3> instrument in place,,,evt002arg03instrument,,
12
+ artifactexistence.damagedestroy.damage,Damager damaged something using instrument in <arg4> place,,,,evt002arg04place,
13
+ artifactexistence.damagedestroy.destroy,<arg1> destroyed something using instrument in place,evt003arg01destroyer,,,,
14
+ artifactexistence.damagedestroy.destroy,Damager destroyed <arg2> using instrument in place,,evt003arg02artifact,,,
15
+ artifactexistence.damagedestroy.destroy,Damager destroyed something using <arg3> instrument in place,,,evt003arg03instrument,,
16
+ artifactexistence.damagedestroy.destroy,Damager destroyed something using instrument in <arg4> place,,,,evt003arg04place,
17
+ artifactexistence.shortage.shortage,<arg1> experienced a shortage of something supply at place,evt149arg01experiencer ,,,,
18
+ artifactexistence.shortage.shortage,Experiencer experienced a shortage of <arg2> supply at place,,evt149arg02supply ,,,
19
+ artifactexistence.shortage.shortage,Experiencer experienced a shortage of something supply at <arg3> place,,,evt149arg03place ,,
20
+ conflict.attack.unspecified,<arg1> attacked target using something at place,evt004arg01attacker,,,,
21
+ conflict.attack.unspecified,Attacker attacked <arg2> using something at place,,evt004arg02target,,,
22
+ conflict.attack.unspecified,Attacker attacked target using <arg3> at place,,,evt004arg03instrument,,
23
+ conflict.attack.unspecified,Attacker attacked target using something at <arg4> place,,,,evt004arg04place,
24
+ conflict.attack.airstrikemissilestrike,<arg1> attacked target using something at place,evt005arg01attacker,,,,
25
+ conflict.attack.airstrikemissilestrike,Attacker attacked <arg2> using something at place,,evt005arg02target,,,
26
+ conflict.attack.airstrikemissilestrike,Attacker attacked target using <arg3> at place,,,evt005arg03instrument,,
27
+ conflict.attack.airstrikemissilestrike,Attacker attacked target using something at <arg4> place,,,,evt005arg04place,
28
+ conflict.attack.biologicalchemicalpoisonattack,<arg1> attacked target using something at place,evt006arg01attacker,,,,
29
+ conflict.attack.biologicalchemicalpoisonattack,Attacker attacked <arg2> using something at place,,evt006arg02target,,,
30
+ conflict.attack.biologicalchemicalpoisonattack,Attacker attacked target using <arg3> at place,,,evt006arg03instrument,,
31
+ conflict.attack.biologicalchemicalpoisonattack,Attacker attacked target using something at <arg4> place,,,,evt006arg04place,
32
+ conflict.attack.bombing,<arg1> attacked target using something at place,evt007arg01attacker,,,,
33
+ conflict.attack.bombing,Attacker attacked <arg2> using something at place,,evt007arg02target,,,
34
+ conflict.attack.bombing,Attacker attacked target using <arg3> at place,,,evt007arg03instrument,,
35
+ conflict.attack.bombing,Attacker attacked target using something at <arg4> place,,,,evt007arg04place,
36
+ conflict.attack.firearmattack,<arg1> attacked target using something at place,evt008arg01attacker,,,,
37
+ conflict.attack.firearmattack,Attacker attacked <arg2> using something at place,,evt008arg02target,,,
38
+ conflict.attack.firearmattack,Attacker attacked target using <arg3> at place,,,evt008arg03instrument,,
39
+ conflict.attack.firearmattack,Attacker attacked target using something at <arg4> place,,,,evt008arg04place,
40
+ conflict.attack.hanging,<arg1> attacked target using something at place,evt009arg01attacker,,,,
41
+ conflict.attack.hanging,Attacker attacked <arg2> using something at place,,evt009arg02target,,,
42
+ conflict.attack.hanging,Attacker attacked target using <arg3> at place,,,evt009arg03instrument,,
43
+ conflict.attack.hanging,Attacker attacked target using something at <arg4> place,,,,evt009arg04place,
44
+ conflict.attack.invade,<arg1> attacked target using something at place,evt010arg01attacker,,,,
45
+ conflict.attack.invade,Attacker attacked <arg2> using something at place,,evt010arg02target,,,
46
+ conflict.attack.invade,Attacker attacked target using <arg3> at place,,,evt010arg03instrument,,
47
+ conflict.attack.invade,Attacker attacked target using something at <arg4> place,,,,evt010arg04place,
48
+ conflict.attack.selfdirectedbattle,<arg1> attacked target using something at place,evt011arg01attacker,,,,
49
+ conflict.attack.selfdirectedbattle,Attacker attacked <arg2> using something at place,,evt011arg02target,,,
50
+ conflict.attack.selfdirectedbattle,Attacker attacked target using <arg3> at place,,,evt011arg03instrument,,
51
+ conflict.attack.selfdirectedbattle,Attacker attacked target using something at <arg4> place,,,,evt011arg04place,
52
+ conflict.attack.setfire,<arg1> attacked target using something at place,evt012arg01attacker,,,,
53
+ conflict.attack.setfire,Attacker attacked <arg2> using something at place,,evt012arg02target,,,
54
+ conflict.attack.setfire,Attacker attacked target using <arg3> at place,,,evt012arg03instrument,,
55
+ conflict.attack.setfire,Attacker attacked target using something at <arg4> place,,,,evt012arg04place,
56
+ conflict.attack.stabbing,<arg1> attacked target using something at place,evt013arg01attacker,,,,
57
+ conflict.attack.stabbing,Attacker attacked <arg2> using something at place,,evt013arg02target,,,
58
+ conflict.attack.stabbing,Attacker attacked target using <arg3> at place,,,evt013arg03instrument,,
59
+ conflict.attack.stabbing,Attacker attacked target using something at <arg4> place,,,,evt013arg04place,
60
+ conflict.attack.stealrobhijack,<arg1> attacked target using something at place in order to take something,evt014arg01attacker,,,,
61
+ conflict.attack.stealrobhijack,Attacker attacked <arg2> using something at place in order to take something,,evt014arg02target,,,
62
+ conflict.attack.stealrobhijack,Attacker attacked target using <arg3> at place in order to take something,,,evt014arg03instrument,,
63
+ conflict.attack.stealrobhijack,Attacker attacked target using something at <arg4> place in order to take something,,,,evt014arg04place,
64
+ conflict.attack.stealrobhijack,Attacker attacked target using something at place in order to take <arg5>,,,,,evt014arg05artifact
65
+ conflict.attack.strangling,<arg1> attacked target using something at place,evt015arg01attacker,,,,
66
+ conflict.attack.strangling,Attacker attacked <arg2> using something at place,,evt015arg02target,,,
67
+ conflict.attack.strangling,Attacker attacked target using <arg3> at place,,,evt015arg03instrument,,
68
+ conflict.attack.strangling,Attacker attacked target using something at <arg4> place,,,,evt015arg04place,
69
+ conflict.coup.coup,<arg1> was deposed by somebody at place,evt151arg01deposedentity ,,,,
70
+ conflict.coup.coup,Somebody was deposed by <arg2> at place,,evt151arg02deposingentity ,,,
71
+ conflict.coup.coup,Somebody was deposed by somebody at <arg3> place,,,evt151arg03place ,,
72
+ conflict.demonstrate.unspecified,<arg1> was in a demonstration at place,evt016arg01demonstrator,,,,
73
+ conflict.demonstrate.unspecified,Demonstrator was in a demonstration at <arg2> place,,evt016arg02place,,,
74
+ conflict.demonstrate.marchprotestpoliticalgathering,<arg1> was in a demonstration or protest at place,evt017arg01demonstrator,,,,
75
+ conflict.demonstrate.marchprotestpoliticalgathering,Demonstrator was in a demonstration or protest at <arg2> place,,evt017arg02place,,,
76
+ conflict.yield.unspecified,<arg1> yielded to recipient at place,evt018arg01yielder,,,,
77
+ conflict.yield.unspecified,Yielder yielded to <arg2> at place,,evt018arg02recipient,,,
78
+ conflict.yield.unspecified,Yielder yielded to recipient at <arg3> place,,,evt018arg03place,,
79
+ conflict.yield.retreat,<arg1> retreated from original place to target place,evt019arg01retreater,,,,
80
+ conflict.yield.retreat,Retreater retreated from <arg2> place to target place,,evt019arg02origin,,,
81
+ conflict.yield.retreat,Retreater retreated from original place to <arg3> place,,,evt019arg03destination,,
82
+ conflict.yield.surrender,<arg1> surrendered to recipient at place,evt020arg01surrenderer,,,,
83
+ conflict.yield.surrender,Surrenderer surrendered to <arg2> at place,,evt020arg02recipient,,,
84
+ conflict.yield.surrender,Surrenderer surrendered to recipient at <arg3> place,,,evt020arg03place,,
85
+ contact.collaborate.unspecified,<arg1> communicated with participant at place,evt021arg01participant,,,,
86
+ contact.collaborate.unspecified,Participant communicated with <arg2> at place,,evt021arg02participant,,,
87
+ contact.collaborate.unspecified,Participant communicated with participant at <arg3> place,,,evt021arg03place,,
88
+ contact.collaborate.correspondence,<arg1> communicated remotely with participant at place,evt022arg01participant,,,,
89
+ contact.collaborate.correspondence,Participant communicated remotely with <arg2> at place,,evt022arg02participant,,,
90
+ contact.collaborate.correspondence,Participant communicated remotely with participant at <arg3> place,,,evt022arg03place,,
91
+ contact.collaborate.meet,<arg1> met face-to-face with participant at place,evt023arg01participant,,,,
92
+ contact.collaborate.meet,Participant met face-to-face with <arg2> at place,,evt023arg02participant,,,
93
+ contact.collaborate.meet,Participant met face-to-face with participant at <arg3> place,,,evt023arg03place,,
94
+ contact.commandorder.unspecified,<arg1> communicated with recipient about topic at place,evt024arg01communicator,,,,
95
+ contact.commandorder.unspecified,Communicator communicated with <arg2> about topic at place,,evt024arg02recipient,,,
96
+ contact.commandorder.unspecified,Communicator communicated with recipient about topic at <arg3> place,,,evt024arg03place,,
97
+ contact.commandorder.unspecified,Communicator communicated with recipient about <arg4> topic at place,,,,evt024arg04topic,
98
+ contact.commandorder.broadcast,<arg1> communicated to recipient about topic at place (one-way communication),evt025arg01communicator,,,,
99
+ contact.commandorder.broadcast,Communicator communicated to <arg2> about topic at place (one-way communication),,evt025arg02recipient,,,
100
+ contact.commandorder.broadcast,Communicator communicated to recipient about topic at <arg3> place (one-way communication),,,evt025arg03place,,
101
+ contact.commandorder.broadcast,Communicator communicated to recipient about <arg4> topic at place (one-way communication),,,,evt025arg04topic,
102
+ contact.commandorder.correspondence,<arg1> communicated remotely with recipient about topic at place,evt026arg01communicator,,,,
103
+ contact.commandorder.correspondence,Communicator communicated remotely with <arg2> about topic at place,,evt026arg02recipient,,,
104
+ contact.commandorder.correspondence,Communicator communicated remotely with recipient about topic at <arg3> place,,,evt026arg03place,,
105
+ contact.commandorder.correspondence,Communicator communicated remotely with recipient about <arg4> topic at place,,,,evt026arg04topic,
106
+ contact.commandorder.meet,<arg1> met face-to-face with recipient about topic at place,evt027arg01communicator,,,,
107
+ contact.commandorder.meet,Communicator met face-to-face with <arg2> about topic at place,,evt027arg02recipient,,,
108
+ contact.commandorder.meet,Communicator met face-to-face with recipient about topic at <arg3> place,,,evt027arg03place,,
109
+ contact.commandorder.meet,Communicator met face-to-face with recipient about <arg4> topic at place,,,,evt027arg04topic,
110
+ contact.commitmentpromiseexpressintent.unspecified,<arg1> communicated with recipient about topic at place,evt028arg01communicator,,,,
111
+ contact.commitmentpromiseexpressintent.unspecified,Communicator communicated with <arg2> about topic at place,,evt028arg02recipient,,,
112
+ contact.commitmentpromiseexpressintent.unspecified,Communicator communicated with recipient about topic at <arg3> place,,,evt028arg03place,,
113
+ contact.commitmentpromiseexpressintent.unspecified,Communicator communicated with recipient about <arg4> topic at place,,,,evt028arg04topic,
114
+ contact.commitmentpromiseexpressintent.broadcast,<arg1> communicated to recipient about topic at place (one-way communication),evt029arg01communicator,,,,
115
+ contact.commitmentpromiseexpressintent.broadcast,Communicator communicated to <arg2> about topic at place (one-way communication),,evt029arg02recipient,,,
116
+ contact.commitmentpromiseexpressintent.broadcast,Communicator communicated to recipient about topic at <arg3> place (one-way communication),,,evt029arg03place,,
117
+ contact.commitmentpromiseexpressintent.broadcast,Communicator communicated to recipient about <arg4> topic at place (one-way communication),,,,evt029arg04topic,
118
+ contact.commitmentpromiseexpressintent.correspondence,<arg1> communicated remotely with recipient about topic at place,evt030arg01communicator,,,,
119
+ contact.commitmentpromiseexpressintent.correspondence,Communicator communicated remotely with <arg2> about topic at place,,evt030arg02recipient,,,
120
+ contact.commitmentpromiseexpressintent.correspondence,Communicator communicated remotely with recipient about topic at <arg3> place,,,evt030arg03place,,
121
+ contact.commitmentpromiseexpressintent.correspondence,Communicator communicated remotely with recipient about <arg4> topic at place,,,,evt030arg04topic,
122
+ contact.commitmentpromiseexpressintent.meet,<arg1> met face-to-face with recipient about topic at place,evt031arg01communicator,,,,
123
+ contact.commitmentpromiseexpressintent.meet,Communicator met face-to-face with <arg2> about topic at place,,evt031arg02recipient,,,
124
+ contact.commitmentpromiseexpressintent.meet,Communicator met face-to-face with recipient about topic at <arg3> place,,,evt031arg03place,,
125
+ contact.commitmentpromiseexpressintent.meet,Communicator met face-to-face with recipient about <arg4> topic at place,,,,evt031arg04topic,
126
+ contact.discussion.unspecified,<arg1> communicated with participant at place,evt032arg01participant,,,,
127
+ contact.discussion.unspecified,Participant communicated with <arg2> at place,,evt032arg02participant,,,
128
+ contact.discussion.unspecified,Participant communicated with participant at <arg3> place,,,evt032arg03place,,
129
+ contact.discussion.correspondence,<arg1> communicated remotely with participant at place,evt033arg01participant,,,,
130
+ contact.discussion.correspondence,Participant communicated remotely with <arg2> at place,,evt033arg02participant,,,
131
+ contact.discussion.correspondence,Participant communicated remotely with participant at <arg3> place,,,evt033arg03place,,
132
+ contact.discussion.meet,<arg1> met face-to-face with participant at place,evt034arg01participant,,,,
133
+ contact.discussion.meet,Participant met face-to-face with <arg2> at place,,evt034arg02participant,,,
134
+ contact.discussion.meet,Participant met face-to-face with participant at <arg3> place,,,evt034arg03place,,
135
+ contact.funeralvigil.unspecified,<arg1> communicated with participant during a funeral or vigil for something at place,evt035arg01participant,,,,
136
+ contact.funeralvigil.unspecified,Participant communicated with <arg2> during a funeral or vigil for something at place,,evt035arg02participant,,,
137
+ contact.funeralvigil.unspecified,Participant communicated with participant during a funeral or vigil for <arg3> at place,,,evt035arg03deceased,,
138
+ contact.funeralvigil.unspecified,Participant communicated with participant during a funeral or vigil for something at <arg4> place,,,,evt035arg04place,
139
+ contact.funeralvigil.meet,<arg1> met face-to-face with participant during a funeral or vigil for something at place,evt036arg01participant,,,,
140
+ contact.funeralvigil.meet,Participant met face-to-face with <arg2> during a funeral or vigil for something at place,,evt036arg02participant,,,
141
+ contact.funeralvigil.meet,Participant met face-to-face with participant during a funeral or vigil for <arg3> at place,,,evt036arg03deceased,,
142
+ contact.funeralvigil.meet,Participant met face-to-face with participant during a funeral or vigil for something at <arg4> place,,,,evt036arg04place,
143
+ contact.mediastatement.unspecified,<arg1> communicated with participant at place,evt037arg01communicator,,,,
144
+ contact.mediastatement.unspecified,Participant communicated with <arg2> at place,,evt037arg02recipient,,,
145
+ contact.mediastatement.unspecified,Participant communicated with participant at <arg3> place,,,evt037arg03place,,
146
+ contact.mediastatement.broadcast,<arg1> communicated to recipient at place (one-way communication),evt038arg01communicator,,,,
147
+ contact.mediastatement.broadcast,Communicator communicated to <arg2> at place (one-way communication),,evt038arg02recipient,,,
148
+ contact.mediastatement.broadcast,Communicator communicated to recipient at <arg3> place (one-way communication),,,evt038arg03place,,
149
+ contact.negotiate.unspecified,<arg1> communicated with recipient about topic at place,evt039arg01participant,,,,
150
+ contact.negotiate.unspecified,Communicator communicated with <arg2> about topic at place,,evt039arg02participant,,,
151
+ contact.negotiate.unspecified,Communicator communicated with recipient about topic at <arg3> place,,,evt039arg03place,,
152
+ contact.negotiate.unspecified,Communicator communicated with recipient about <arg4> topic at place,,,,evt039arg04topic,
153
+ contact.negotiate.correspondence,<arg1> communicated remotely with participant about topic at place,evt040arg01participant,,,,
154
+ contact.negotiate.correspondence,Participant communicated remotely with <arg2> about topic at place,,evt040arg02participant,,,
155
+ contact.negotiate.correspondence,Participant communicated remotely with participant about topic at <arg3> place,,,evt040arg03place,,
156
+ contact.negotiate.correspondence,Participant communicated remotely with participant about <arg4> topic at place,,,,evt040arg04topic,
157
+ contact.negotiate.meet,<arg1> met face-to-face with recipient about topic at place,evt041arg01participant,,,,
158
+ contact.negotiate.meet,Communicator met face-to-face with <arg2> about topic at place,,evt041arg02participant,,,
159
+ contact.negotiate.meet,Communicator met face-to-face with recipient about topic at <arg3> place,,,evt041arg03place,,
160
+ contact.negotiate.meet,Communicator met face-to-face with recipient about <arg4> topic at place,,,,evt041arg04topic,
161
+ contact.prevarication.unspecified,<arg1> communicated with recipient about topic at place,evt042arg01communicator,,,,
162
+ contact.prevarication.unspecified,Communicator communicated with <arg2> about topic at place,,evt042arg02recipient,,,
163
+ contact.prevarication.unspecified,Communicator communicated with recipient about topic at <arg3> place,,,evt042arg03place,,
164
+ contact.prevarication.unspecified,Communicator communicated with recipient about <arg4> topic at place,,,,evt042arg04topic,
165
+ contact.prevarication.broadcast,<arg1> communicated to recipient about topic at place (one-way communication),evt043arg01communicator,,,,
166
+ contact.prevarication.broadcast,Communicator communicated to <arg2> about topic at place (one-way communication),,evt043arg02recipient,,,
167
+ contact.prevarication.broadcast,Communicator communicated to recipient about topic at <arg3> place (one-way communication),,,evt043arg03place,,
168
+ contact.prevarication.broadcast,Communicator communicated to recipient about <arg4> topic at place (one-way communication),,,,evt043arg04topic,
169
+ contact.prevarication.correspondence,<arg1> communicated remotely with recipient about topic at place,evt044arg01communicator,,,,
170
+ contact.prevarication.correspondence,Communicator communicated remotely with <arg2> about topic at place,,evt044arg02recipient,,,
171
+ contact.prevarication.correspondence,Communicator communicated remotely with recipient about topic at <arg3> place,,,evt044arg03place,,
172
+ contact.prevarication.correspondence,Communicator communicated remotely with recipient about <arg4> topic at place,,,,evt044arg04topic,
173
+ contact.prevarication.meet,<arg1> met face-to-face with recipient about topic at place,evt045arg01communicator,,,,
174
+ contact.prevarication.meet,Communicator met face-to-face with <arg2> about topic at place,,evt045arg02recipient,,,
175
+ contact.prevarication.meet,Communicator met face-to-face with recipient about topic at <arg3> place,,,evt045arg03place,,
176
+ contact.prevarication.meet,Communicator met face-to-face with recipient about <arg4> topic at place,,,,evt045arg04topic,
177
+ contact.publicstatementinperson.unspecified,<arg1> communicated with participant at place,evt046arg01communicator,,,,
178
+ contact.publicstatementinperson.unspecified,Participant communicated with <arg2> at place,,evt046arg02recipient,,,
179
+ contact.publicstatementinperson.unspecified,Participant communicated with participant at <arg3> place,,,evt046arg03place,,
180
+ contact.publicstatementinperson.broadcast,<arg1> communicated to recipient at place (one-way communication),evt047arg01communicator,,,,
181
+ contact.publicstatementinperson.broadcast,Communicator communicated to <arg2> at place (one-way communication),,evt047arg02recipient,,,
182
+ contact.publicstatementinperson.broadcast,Communicator communicated to recipient at <arg3> place (one-way communication),,,evt047arg03place,,
183
+ contact.requestadvise.unspecified,<arg1> communicated with recipient about topic at place,evt048arg01communicator,,,,
184
+ contact.requestadvise.unspecified,Communicator communicated with <arg2> about topic at place,,evt048arg02recipient,,,
185
+ contact.requestadvise.unspecified,Communicator communicated with recipient about topic at <arg3> place,,,evt048arg03place,,
186
+ contact.requestadvise.unspecified,Communicator communicated with recipient about <arg4> topic at place,,,,evt048arg04topic,
187
+ contact.requestadvise.broadcast,<arg1> communicated to recipient about topic at place (one-way communication),evt049arg01communicator,,,,
188
+ contact.requestadvise.broadcast,Communicator communicated to <arg2> about topic at place (one-way communication),,evt049arg02recipient,,,
189
+ contact.requestadvise.broadcast,Communicator communicated to recipient about topic at <arg3> place (one-way communication),,,evt049arg03place,,
190
+ contact.requestadvise.broadcast,Communicator communicated to recipient about <arg4> topic at place (one-way communication),,,,evt049arg04topic,
191
+ contact.requestadvise.correspondence,<arg1> communicated remotely with recipient about topic at place,evt050arg01communicator,,,,
192
+ contact.requestadvise.correspondence,Communicator communicated remotely with <arg2> about topic at place,,evt050arg02recipient,,,
193
+ contact.requestadvise.correspondence,Communicator communicated remotely with recipient about topic at <arg3> place,,,evt050arg03place,,
194
+ contact.requestadvise.correspondence,Communicator communicated remotely with recipient about <arg4> topic at place,,,,evt050arg04topic,
195
+ contact.requestadvise.meet,<arg1> met face-to-face with recipient about topic at place,evt051arg01communicator,,,,
196
+ contact.requestadvise.meet,Communicator met face-to-face with <arg2> about topic at place,,evt051arg02recipient,,,
197
+ contact.requestadvise.meet,Communicator met face-to-face with recipient about topic at <arg3> place,,,evt051arg03place,,
198
+ contact.requestadvise.meet,Communicator met face-to-face with recipient about <arg4> topic at place,,,,evt051arg04topic,
199
+ contact.threatencoerce.unspecified,<arg1> communicated with recipient about topic at place,evt052arg01communicator,,,,
200
+ contact.threatencoerce.unspecified,Communicator communicated with <arg2> about topic at place,,evt052arg02recipient,,,
201
+ contact.threatencoerce.unspecified,Communicator communicated with recipient about topic at <arg3> place,,,evt052arg03place,,
202
+ contact.threatencoerce.unspecified,Communicator communicated with recipient about <arg4> topic at place,,,,evt052arg04topic,
203
+ contact.threatencoerce.broadcast,<arg1> communicated to recipient about topic at place (one-way communication),evt053arg01communicator,,,,
204
+ contact.threatencoerce.broadcast,Communicator communicated to <arg2> about topic at place (one-way communication),,evt053arg02recipient,,,
205
+ contact.threatencoerce.broadcast,Communicator communicated to recipient about topic at <arg3> place (one-way communication),,,evt053arg03place,,
206
+ contact.threatencoerce.broadcast,Communicator communicated to recipient about <arg4> topic at place (one-way communication),,,,evt053arg04topic,
207
+ contact.threatencoerce.correspondence,<arg1> communicated remotely with recipient about topic at place,evt054arg01communicator,,,,
208
+ contact.threatencoerce.correspondence,Communicator communicated remotely with <arg2> about topic at place,,evt054arg02recipient,,,
209
+ contact.threatencoerce.correspondence,Communicator communicated remotely with recipient about topic at <arg3> place,,,evt054arg03place,,
210
+ contact.threatencoerce.correspondence,Communicator communicated remotely with recipient about <arg4> topic at place,,,,evt054arg04topic,
211
+ contact.threatencoerce.meet,<arg1> met face-to-face with recipient about topic at place,evt055arg01communicator,,,,
212
+ contact.threatencoerce.meet,Communicator met face-to-face with <arg2> about topic at place,,evt055arg02recipient,,,
213
+ contact.threatencoerce.meet,Communicator met face-to-face with recipient about topic at <arg3> place,,,evt055arg03place,,
214
+ contact.threatencoerce.meet,Communicator met face-to-face with recipient about <arg4> topic at place,,,,evt055arg04topic,
215
+ disaster.accidentcrash.accidentcrash,<arg1> person in vehicle crashed into something at place,evt057arg01driverpassenger,,,,
216
+ disaster.accidentcrash.accidentcrash,Person in <arg2> vehicle crashed into something at place,,evt057arg02vehicle,,,
217
+ disaster.accidentcrash.accidentcrash,Person in vehicle crashed into <arg3> at place,,,evt057arg03crashobject,,
218
+ disaster.accidentcrash.accidentcrash,Person in vehicle crashed into something at <arg4> place,,,,evt057arg04place,
219
+ disaster.diseaseoutbreak.diseaseoutbreak,<arg1> disease broke out among victims or population at place,evt148arg01disease ,,,,
220
+ disaster.diseaseoutbreak.diseaseoutbreak,Disease broke out among <arg2> victims or population at place,,evt148arg02victim ,,,
221
+ disaster.diseaseoutbreak.diseaseoutbreak,Disease broke out among victims or population at <arg3> place,,,evt148arg03place ,,
222
+ disaster.fireexplosion.fireexplosion,<arg1> caught fire or exploded from instrument at place,evt059arg01fireexplosionobject,,,,
223
+ disaster.fireexplosion.fireexplosion,Something caught fire or exploded from <arg2> instrument at place,,evt059arg02instrument,,,
224
+ disaster.fireexplosion.fireexplosion,Something caught fire or exploded from instrument at <arg3> place,,,evt059arg03place,,
225
+ genericcrime.genericcrime.genericcrime,<arg1> committed a crime against victim at place,evt154arg01perpetrator ,,,,
226
+ genericcrime.genericcrime.genericcrime,Perpetrator committed a crime against <arg2> at place,,evt154arg02victim ,,,
227
+ genericcrime.genericcrime.genericcrime,Perpetrator committed a crime against victim at <arg3> place,,,evt154arg03place ,,
228
+ government.agreements.unspecified,<arg1> and participant signed an agreement in place,evt060arg01participant,,,,
229
+ government.agreements.unspecified,Participant and <arg2> signed an agreement in place,,evt060arg02participant,,,
230
+ government.agreements.unspecified,Participant and participant signed an agreement in <arg3> place,,,evt060arg03place,,
231
+ government.agreements.acceptagreementcontractceasefire,<arg1> and participant signed an agreement in place,evt061arg01participant,,,,
232
+ government.agreements.acceptagreementcontractceasefire,Participant and <arg2> signed an agreement in place,,evt061arg02participant,,,
233
+ government.agreements.acceptagreementcontractceasefire,Participant and participant signed an agreement in <arg3> place,,,evt061arg03place,,
234
+ government.agreements.rejectnullifyagreementcontractceasefire,<arg1> rejected or nullified an agreement with participant in place,evt062arg01rejecternullifier,,,,
235
+ government.agreements.rejectnullifyagreementcontractceasefire,Rejecter rejected or nullified an agreement with <arg2> in place,,evt062arg02otherparticipant,,,
236
+ government.agreements.rejectnullifyagreementcontractceasefire,Rejecter rejected or nullified an agreement with participant in <arg3> place,,,evt062arg03place,,
237
+ government.agreements.violateagreement,<arg1> violated an agreement with participant in place,evt063arg01violator,,,,
238
+ government.agreements.violateagreement,Violator violated an agreement with <arg2> in place,,evt063arg02otherparticipant,,,
239
+ government.agreements.violateagreement,Violator violated an agreement with participant in <arg3> place,,,evt063arg03place,,
240
+ government.convene.convene,<arg1> convened somebody at place,evt145arg01convener ,,,,
241
+ government.convene.convene,Convener convened <arg2> at place,,evt145arg02convenedthing ,,,
242
+ government.convene.convene,Convener convened somebody at <arg3> place,,,evt145arg03place ,,
243
+ government.formation.unspecified,<arg1> was formed by founder in place,evt064arg01gpe,,,,
244
+ government.formation.unspecified,Somebody was formed by <arg2> in place,,evt064arg02founder,,,
245
+ government.formation.unspecified,Somebody was formed by founder in <arg3> place,,,evt064arg03place,,
246
+ government.formation.mergegpe,<arg1> merged with participant at place,evt065arg01participant,,,,
247
+ government.formation.mergegpe,Participant merged with <arg2> at place,,evt065arg02participant,,,
248
+ government.formation.mergegpe,Participant merged with participant at <arg3> place,,,evt065arg03place,,
249
+ government.formation.startgpe,<arg1> was started by founder in place,evt066arg01gpe,,,,
250
+ government.formation.startgpe,Something was started by <arg2> in place,,evt066arg02founder,,,
251
+ government.formation.startgpe,Something was started by founder in <arg3> place,,,evt066arg03place,,
252
+ government.legislate.legislate,<arg1> legislature enacted law in place,evt068arg01governmentbody,,,,
253
+ government.legislate.legislate,Government legislature enacted <arg2> law in place,,evt068arg02law,,,
254
+ government.legislate.legislate,Government legislature enacted law in <arg3> place,,,evt068arg03place,,
255
+ government.spy.spy,<arg1> spied on something to the benefit of beneficiary in place,evt070arg01spy,,,,
256
+ government.spy.spy,Spy spied on <arg2> to the benefit of beneficiary in place,,evt070arg02observedentity,,,
257
+ government.spy.spy,Spy spied on something to the benefit of <arg3> in place,,,evt070arg03beneficiary,,
258
+ government.spy.spy,Spy spied on something to the benefit of beneficiary in <arg4> place,,,,evt070arg04place,
259
+ government.vote.unspecified,<arg1> voted for candidate on ballot with results in place,evt071arg01voter,,,,
260
+ government.vote.unspecified,Voter voted for <arg2> on ballot with results in place,,evt071arg02candidate,,,
261
+ government.vote.unspecified,Voter voted for candidate on <arg3> ballot with results in place,,,evt071arg03ballot,,
262
+ government.vote.unspecified,Voter voted for candidate on ballot with <arg4> results in place,,,,evt071arg04result,
263
+ government.vote.unspecified,Voter voted for candidate on ballot with results in <arg5> place,,,,,evt071arg05place
264
+ government.vote.castvote,<arg1> voted for candidate on ballot with results in place,evt072arg01voter,,,,
265
+ government.vote.castvote,Voter voted for <arg2> on ballot with results in place,,evt072arg02candidate,,,
266
+ government.vote.castvote,Voter voted for candidate on <arg3> ballot with results in place,,,evt072arg03ballot,,
267
+ government.vote.castvote,Voter voted for candidate on ballot with <arg4> results in place,,,,evt072arg04result,
268
+ government.vote.castvote,Voter voted for candidate on ballot with results in <arg5> place,,,,,evt072arg05place
269
+ government.vote.violationspreventvote,<arg1> prevented voter from voting for candidate on ballot in place,evt073arg01preventer,,,,
270
+ government.vote.violationspreventvote,Preventer prevented <arg2> from voting for candidate on ballot in place,,evt073arg02voter,,,
271
+ government.vote.violationspreventvote,Preventer prevented voter from voting for <arg3> on ballot in place,,,evt073arg03candidate,,
272
+ government.vote.violationspreventvote,Preventer prevented voter from voting for candidate on <arg4> ballot in place,,,,evt073arg04ballot,
273
+ government.vote.violationspreventvote,Preventer prevented voter from voting for candidate on ballot in <arg5> place,,,,,evt073arg05place
274
+ inspection.sensoryobserve.unspecified,<arg1> observed something in place,evt074arg01observer,,,,
275
+ inspection.sensoryobserve.unspecified,Observer observed <arg2> in place,,evt074arg02observedentity,,,
276
+ inspection.sensoryobserve.unspecified,Observer observed something in <arg3> place,,,evt074arg03place,,
277
+ inspection.sensoryobserve.inspectpeopleorganization,<arg1> inspected something in place,evt075arg01inspector,,,,
278
+ inspection.sensoryobserve.inspectpeopleorganization,Inspector inspected <arg2> in place,,evt075arg02inspectedentity,,,
279
+ inspection.sensoryobserve.inspectpeopleorganization,Inspector inspected something in <arg3> place,,,evt075arg03place,,
280
+ inspection.sensoryobserve.monitorelection,<arg1> monitored something taking part in an election in place,evt076arg01monitor,,,,
281
+ inspection.sensoryobserve.monitorelection,Monitor monitored <arg2> taking part in an election in place,,evt076arg02monitoredentity,,,
282
+ inspection.sensoryobserve.monitorelection,Monitor monitored something taking part in an election in <arg3> place,,,evt076arg03place,,
283
+ inspection.sensoryobserve.physicalinvestigateinspect,<arg1> inspected something in place,evt077arg01inspector,,,,
284
+ inspection.sensoryobserve.physicalinvestigateinspect,Inspector inspected <arg2> in place,,evt077arg02inspectedentity,,,
285
+ inspection.sensoryobserve.physicalinvestigateinspect,Inspector inspected something in <arg3> place,,,evt077arg03place,,
286
+ inspection.targetaimat.targetaimat,<arg1> physically targeted target with instrument at place,evt153arg01targeter ,,,,
287
+ inspection.targetaimat.targetaimat,Targeter physically targeted <arg2> with instrument at place,,evt153arg02target ,,,
288
+ inspection.targetaimat.targetaimat,Targeter physically targeted target with <arg3> instrument at place,,,evt153arg03instrument ,,
289
+ inspection.targetaimat.targetaimat,Targeter physically targeted target with instrument at <arg4> place,,,,evt153arg04place ,
290
+ justice.arrestjaildetain.arrestjaildetain,<arg1> arrested or jailed detainee for crime at place,evt079arg01jailer,,,,
291
+ justice.arrestjaildetain.arrestjaildetain,Jailer arrested or jailed <arg2> for crime at place,,evt079arg02detainee,,,
292
+ justice.arrestjaildetain.arrestjaildetain,Jailer arrested or jailed detainee for <arg3> crime at place,,,evt079arg03crime,,
293
+ justice.arrestjaildetain.arrestjaildetain,Jailer arrested or jailed detainee for crime at <arg4> place,,,,evt079arg04place,
294
+ justice.initiatejudicialprocess.unspecified,<arg1> initiated judicial process pertaining to defendant before court or judge for crime in place,evt080arg01prosecutor,,,,
295
+ justice.initiatejudicialprocess.unspecified,Prosecutor initiated judicial process pertaining to <arg2> before court or judge for crime in place,,evt080arg02defendant,,,
296
+ justice.initiatejudicialprocess.unspecified,Prosecutor initiated judicial process pertaining to defendant before <arg3> court or judge for crime in place,,,evt080arg03judgecourt,,
297
+ justice.initiatejudicialprocess.unspecified,Prosecutor initiated judicial process pertaining to defendant before court or judge for <arg4> crime in place,,,,evt080arg04crime,
298
+ justice.initiatejudicialprocess.unspecified,Prosecutor initiated judicial process pertaining to defendant before court or judge for crime in <arg5> place,,,,,evt080arg05place
299
+ justice.initiatejudicialprocess.chargeindict,<arg1> charged or indicted defendant before court or judge for crime in place,evt081arg01prosecutor,,,,
300
+ justice.initiatejudicialprocess.chargeindict,Prosecutor charged or indicted <arg2> before court or judge for crime in place,,evt081arg02defendant,,,
301
+ justice.initiatejudicialprocess.chargeindict,Prosecutor charged or indicted defendant before <arg3> court or judge for crime in place,,,evt081arg03judgecourt,,
302
+ justice.initiatejudicialprocess.chargeindict,Prosecutor charged or indicted defendant before court or judge for <arg4> crime in place,,,,evt081arg04crime,
303
+ justice.initiatejudicialprocess.chargeindict,Prosecutor charged or indicted defendant before court or judge for crime in <arg5> place,,,,,evt081arg05place
304
+ justice.initiatejudicialprocess.trialhearing,<arg1> tried defendant before court or judge for crime in place,evt082arg01prosecutor,,,,
305
+ justice.initiatejudicialprocess.trialhearing,Prosecutor tried <arg2> before court or judge for crime in place,,evt082arg02defendant,,,
306
+ justice.initiatejudicialprocess.trialhearing,Prosecutor tried defendant before <arg3> court or judge for crime in place,,,evt082arg03judgecourt,,
307
+ justice.initiatejudicialprocess.trialhearing,Prosecutor tried defendant before court or judge for <arg4> crime in place,,,,evt082arg04crime,
308
+ justice.initiatejudicialprocess.trialhearing,Prosecutor tried defendant before court or judge for crime in <arg5> place,,,,,evt082arg05place
309
+ justice.investigate.unspecified,<arg1> investigated defendant in place,evt083arg01investigator,,,,
310
+ justice.investigate.unspecified,Investigator investigated <arg2> in place,,evt083arg02defendant,,,
311
+ justice.investigate.unspecified,Investigator investigated defendant in <arg3> place,,,evt083arg03place,,
312
+ justice.investigate.investigatecrime,<arg1> investigated defendant for crime in place,evt084arg01investigator,,,,
313
+ justice.investigate.investigatecrime,Investigator investigated <arg2> for crime in place,,evt084arg02defendant,,,
314
+ justice.investigate.investigatecrime,Investigator investigated defendant for <arg3> crime in place,,,evt084arg03crime,,
315
+ justice.investigate.investigatecrime,Investigator investigated defendant for crime in <arg4> place,,,,evt084arg04place,
316
+ justice.judicialconsequences.unspecified,<arg1> court or judge decided consequences of crime committed by defendant in place,evt085arg01judgecourt,,,,
317
+ justice.judicialconsequences.unspecified,Court or judge decided consequences of crime committed by <arg2> in place,,evt085arg02defendant,,,
318
+ justice.judicialconsequences.unspecified,Court or judge decided consequences of <arg3> crime committed by defendant in place,,,evt085arg03crime,,
319
+ justice.judicialconsequences.unspecified,Court or judge decided consequences of crime committed by defendant in <arg4> place,,,,evt085arg04place,
320
+ justice.judicialconsequences.convict,<arg1> court or judge convicted defendant of crime in place,evt086arg01judgecourt,,,,
321
+ justice.judicialconsequences.convict,Court or judge convicted <arg2> of crime in place,,evt086arg02defendant,,,
322
+ justice.judicialconsequences.convict,Court or judge convicted defendant of <arg3> crime in place,,,evt086arg03crime,,
323
+ justice.judicialconsequences.convict,Court or judge convicted defendant of crime in <arg4> place,,,,evt086arg04place,
324
+ justice.judicialconsequences.execute,<arg1> executed defendant for crime in place,evt087arg01executioner,,,,
325
+ justice.judicialconsequences.execute,Executioner executed <arg2> for crime in place,,evt087arg02defendant,,,
326
+ justice.judicialconsequences.execute,Executioner executed defendant for <arg3> crime in place,,,evt087arg03crime,,
327
+ justice.judicialconsequences.execute,Executioner executed defendant for crime in <arg4> place,,,,evt087arg04place,
328
+ justice.judicialconsequences.extradite,<arg1> extradited defendant for crime from place to place,evt088arg01extraditer,,,,
329
+ justice.judicialconsequences.extradite,Extraditer extradited <arg2> for crime from place to place,,evt088arg02defendant,,,
330
+ justice.judicialconsequences.extradite,Extraditer extradited defendant for <arg3> crime from place to place,,,evt088arg03crime,,
331
+ justice.judicialconsequences.extradite,Extraditer extradited defendant for crime from <arg4> place to place,,,,evt088arg04origin,
332
+ justice.judicialconsequences.extradite,Extraditer extradited defendant for crime from place to <arg5> place,,,,,evt088arg05destination
333
+ life.die.unspecified,<arg1> died at place from medical issue killed by killer,evt089arg01victim,,,,
334
+ life.die.unspecified,Victim died at <arg2> place from medical issue killed by killer,,evt089arg02place,,,
335
+ life.die.unspecified,Victim died at place from medical issue killed by <arg3> killer,,,evt089arg03killer,,
336
+ life.die.unspecified,Victim died at place from <arg4> medical issue killed by killer,,,,evt089arg04medicalissue,
337
+ life.die.deathcausedbyviolentevents,<arg1> killed victim using instrument or medical issue at place,evt090arg01killer,,,,
338
+ life.die.deathcausedbyviolentevents,Killer killed <arg2> using instrument or medical issue at place,,evt090arg02victim,,,
339
+ life.die.deathcausedbyviolentevents,Killer killed victim using <arg3> instrument or medical issue at place,,,evt090arg03instrument,,
340
+ life.die.deathcausedbyviolentevents,Killer killed victim using instrument or medical issue at <arg4> place,,,,evt090arg04place,
341
+ life.die.deathcausedbyviolentevents,Killer killed victim using instrument or <arg5> medical issue at place,,,,,evt090arg05medicalissue
342
+ life.die.nonviolentdeath,<arg1> died at place from medical issue killed by killer,evt091arg01victim,,,,
343
+ life.die.nonviolentdeath,Victim died at <arg2> place from medical issue killed by killer,,evt091arg02place,,,
344
+ life.die.nonviolentdeath,Victim died at place from medical issue killed by <arg3> killer,,,evt091arg03killer,,
345
+ life.die.nonviolentdeath,Victim died at place from <arg4> medical issue killed by killer,,,,evt091arg04medicalissue,
346
+ life.injure.unspecified,<arg1> was injured by injurer with medical issue at place,evt092arg01victim,,,,
347
+ life.injure.unspecified,Victim was injured by <arg2> with medical issue at place,,evt092arg02injurer,,,
348
+ life.injure.unspecified,Victim was injured by injurer with medical issue at <arg3> place,,,evt092arg03place,,
349
+ life.injure.unspecified,Victim was injured by injurer with <arg4> medical issue at place,,,,evt092arg04medicalissue,
350
+ life.injure.illnessdegradationhungerthirst,<arg1> has extreme hunger or thirst from medical issue imposed by injurer at place,evt093arg01victim,,,,
351
+ life.injure.illnessdegradationhungerthirst,Victim has extreme hunger or thirst from medical issue imposed by injurer at <arg2> place,,evt093arg02place,,,
352
+ life.injure.illnessdegradationhungerthirst,Victim has extreme hunger or thirst from medical issue imposed by <arg3> injurer at place,,,evt093arg03injurer,,
353
+ life.injure.illnessdegradationhungerthirst,Victim has extreme hunger or thirst from <arg4> medical issue imposed by injurer at place,,,,evt093arg04medicalissue,
354
+ life.injure.illnessdegradationphysical,<arg1> person has some physical degradation from medical issue imposed by injurer at place,evt094arg01victim,,,,
355
+ life.injure.illnessdegradationphysical,Victim person has some physical degradation from medical issue imposed by injurer at <arg2> place,,evt094arg02place,,,
356
+ life.injure.illnessdegradationphysical,Victim person has some physical degradation from medical issue imposed by <arg3> injurer at place,,,evt094arg03injurer,,
357
+ life.injure.illnessdegradationphysical,Victim person has some physical degradation from <arg4> medical issue imposed by injurer at place,,,,evt094arg04medicalissue,
358
+ life.injure.illnessdegredationsickness,<arg1> has sickness or illness at place deliberately infected by injurer ,evt150arg01victim ,,,,
359
+ life.injure.illnessdegredationsickness,Victim has sickness or illness at place deliberately infected by <arg2>,,evt150arg02injurer ,,,
360
+ life.injure.illnessdegredationsickness,Victim has <arg3> sickness or illness at place deliberately infected by injurer ,,,evt150arg03disease ,,
361
+ life.injure.illnessdegredationsickness,Victim has sickness or illness at <arg4> place deliberately infected by injurer ,,,,evt150arg04place ,
362
+ life.injure.injurycausedbyviolentevents,<arg1> injured victim using instrument or medical issue at place,evt095arg01injurer,,,,
363
+ life.injure.injurycausedbyviolentevents,Injurer injured <arg2> using instrument or medical issue at place,,evt095arg02victim,,,
364
+ life.injure.injurycausedbyviolentevents,Injurer injured victim using <arg3> instrument or medical issue at place,,,evt095arg03instrument,,
365
+ life.injure.injurycausedbyviolentevents,Injurer injured victim using instrument or medical issue at <arg4> place,,,,evt095arg04place,
366
+ life.injure.injurycausedbyviolentevents,Injurer injured victim using instrument or <arg5> medical issue at place,,,,,evt095arg05medicalissue
367
+ manufacture.artifact.unspecified,<arg1> manufactured or created or produced artifact using instrument at place,evt096arg01manufacturer,,,,
368
+ manufacture.artifact.unspecified,Manufacturer manufactured or created or produced <arg2> using instrument at place,,evt096arg02artifact,,,
369
+ manufacture.artifact.unspecified,Manufacturer manufactured or created or produced artifact using <arg3> at place,,,evt096arg03instrument,,
370
+ manufacture.artifact.unspecified,Manufacturer manufactured or created or produced artifact using instrument at <arg4> place,,,,evt096arg04place,
371
+ manufacture.artifact.build,<arg1> manufactured or created or produced artifact using instrument at place,evt097arg01manufacturer,,,,
372
+ manufacture.artifact.build,Manufacturer manufactured or created or produced <arg2> using instrument at place,,evt097arg02artifact,,,
373
+ manufacture.artifact.build,Manufacturer manufactured or created or produced artifact using <arg3> at place,,,evt097arg03instrument,,
374
+ manufacture.artifact.build,Manufacturer manufactured or created or produced artifact using instrument at <arg4> place,,,,evt097arg04place,
375
+ manufacture.artifact.createintellectualproperty,<arg1> manufactured or created or produced artifact using instrument at place,evt098arg01manufacturer,,,,
376
+ manufacture.artifact.createintellectualproperty,Manufacturer manufactured or created or produced <arg2> using instrument at place,,evt098arg02artifact,,,
377
+ manufacture.artifact.createintellectualproperty,Manufacturer manufactured or created or produced artifact using <arg3> at place,,,evt098arg03instrument,,
378
+ manufacture.artifact.createintellectualproperty,Manufacturer manufactured or created or produced artifact using instrument at <arg4> place,,,,evt098arg04place,
379
+ manufacture.artifact.createmanufacture,<arg1> manufactured or created or produced artifact using instrument at place,evt099arg01manufacturer,,,,
380
+ manufacture.artifact.createmanufacture,Manufacturer manufactured or created or produced <arg2> using instrument at place,,evt099arg02artifact,,,
381
+ manufacture.artifact.createmanufacture,Manufacturer manufactured or created or produced artifact using <arg3> at place,,,evt099arg03instrument,,
382
+ manufacture.artifact.createmanufacture,Manufacturer manufactured or created or produced artifact using instrument at <arg4> place,,,,evt099arg04place,
383
+ medical.intervention.intervention,<arg1> treater treated patient for medical issue with means at place,evt147arg01treater ,,,,
384
+ medical.intervention.intervention,Treater treated <arg2> patient for medical issue with means at place,,evt147arg02patient ,,,
385
+ medical.intervention.intervention,Treater treated patient for <arg3> medical issue with means at place,,,evt147arg03medicalissue ,,
386
+ medical.intervention.intervention,Treater treated patient for medical issue with <arg4> means at place,,,,evt147arg04instrument ,
387
+ medical.intervention.intervention,Treater treated patient for medical issue with means at <arg5> place,,,,,evt147arg05place
388
+ movement.transportartifact.unspecified,<arg1> transported artifact in vehicle from place to place,evt100arg01transporter,,,,
389
+ movement.transportartifact.unspecified,Transporter transported <arg2> in vehicle from place to place,,evt100arg02artifact,,,
390
+ movement.transportartifact.unspecified,Transporter transported artifact in <arg3> from place to place,,,evt100arg03vehicle,,
391
+ movement.transportartifact.unspecified,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt100arg04origin,
392
+ movement.transportartifact.unspecified,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt100arg05destination
393
+ movement.transportartifact.bringcarryunload,<arg1> transported artifact in vehicle from place to place,evt101arg01transporter,,,,
394
+ movement.transportartifact.bringcarryunload,Transporter transported <arg2> in vehicle from place to place,,evt101arg02artifact,,,
395
+ movement.transportartifact.bringcarryunload,Transporter transported artifact in <arg3> from place to place,,,evt101arg03vehicle,,
396
+ movement.transportartifact.bringcarryunload,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt101arg04origin,
397
+ movement.transportartifact.bringcarryunload,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt101arg05destination
398
+ movement.transportartifact.disperseseparate,<arg1> transported artifact in vehicle from place to place,evt102arg01transporter,,,,
399
+ movement.transportartifact.disperseseparate,Transporter transported <arg2> in vehicle from place to place,,evt102arg02artifact,,,
400
+ movement.transportartifact.disperseseparate,Transporter transported artifact in <arg3> from place to place,,,evt102arg03vehicle,,
401
+ movement.transportartifact.disperseseparate,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt102arg04origin,
402
+ movement.transportartifact.disperseseparate,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt102arg05destination
403
+ movement.transportartifact.fall,<arg1> fell from place to place,evt103arg01artifact,,,,
404
+ movement.transportartifact.fall,Artifact fell from <arg2> place to place,,evt103arg02origin,,,
405
+ movement.transportartifact.fall,Artifact fell from place to <arg3> place,,,evt103arg03destination,,
406
+ movement.transportartifact.grantentry,<arg1> grants artifact entry to place from place,evt104arg01transporter,,,,
407
+ movement.transportartifact.grantentry,Transporter grants <arg2> entry to place from place,,evt104arg02artifact,,,
408
+ movement.transportartifact.grantentry,Transporter grants artifact entry to <arg3> place from place,,,evt104arg03origin,,
409
+ movement.transportartifact.grantentry,Transporter grants artifact entry to place from <arg4> place,,,,evt104arg04destination,
410
+ movement.transportartifact.hide,<arg1> concealed artifact in place transported in vehicle from place,evt105arg01transporter,,,,
411
+ movement.transportartifact.hide,Transporter concealed <arg2> in place transported in vehicle from place,,evt105arg02artifact,,,
412
+ movement.transportartifact.hide,Transporter concealed artifact in <arg3> place transported in vehicle from place,,,evt105arg03hidingplace,,
413
+ movement.transportartifact.hide,Transporter concealed artifact in place transported in <arg4> vehicle from place,,,,evt105arg04vehicle,
414
+ movement.transportartifact.hide,Transporter concealed artifact in place transported in vehicle from <arg5> place,,,,,evt105arg05origin
415
+ movement.transportartifact.lossofcontrol,<arg1> lost control of moving something at place,evt146arg01controller ,,,,
416
+ movement.transportartifact.lossofcontrol,Controller lost control of moving <arg2> at place,,evt146arg02controlledthing ,,,
417
+ movement.transportartifact.lossofcontrol,Controller lost control of moving something at <arg3> place,,,evt146arg03place ,,
418
+ movement.transportartifact.nonviolentthrowlaunch,<arg1> transported artifact in vehicle from place to place,evt106arg01transporter,,,,
419
+ movement.transportartifact.nonviolentthrowlaunch,Transporter transported <arg2> in vehicle from place to place,,evt106arg02artifact,,,
420
+ movement.transportartifact.nonviolentthrowlaunch,Transporter transported artifact in <arg3> from place to place,,,evt106arg03vehicle,,
421
+ movement.transportartifact.nonviolentthrowlaunch,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt106arg04origin,
422
+ movement.transportartifact.nonviolentthrowlaunch,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt106arg05destination
423
+ movement.transportartifact.prevententry,<arg1> prevents transporter from transporting artifact from place to place,evt107arg01preventer,,,,
424
+ movement.transportartifact.prevententry,Preventer prevents <arg2> from transporting artifact from place to place,,evt107arg02transporter,,,
425
+ movement.transportartifact.prevententry,Preventer prevents transporter from transporting <arg3> from place to place,,,evt107arg03artifact,,
426
+ movement.transportartifact.prevententry,Preventer prevents transporter from transporting artifact from <arg4> place to place,,,,evt107arg04origin,
427
+ movement.transportartifact.prevententry,Preventer prevents transporter from transporting artifact from place to <arg5> place,,,,,evt107arg05destination
428
+ movement.transportartifact.preventexit,<arg1> prevents transporter from transporting artifact from place to place,evt108arg01preventer,,,,
429
+ movement.transportartifact.preventexit,Preventer prevents <arg2> from transporting artifact from place to place,,evt108arg02transporter,,,
430
+ movement.transportartifact.preventexit,Preventer prevents transporter from transporting <arg3> from place to place,,,evt108arg03artifact,,
431
+ movement.transportartifact.preventexit,Preventer prevents transporter from transporting artifact from <arg4> place to place,,,,evt108arg04origin,
432
+ movement.transportartifact.preventexit,Preventer prevents transporter from transporting artifact from place to <arg5> place,,,,,evt108arg05destination
433
+ movement.transportartifact.receiveimport,<arg1> transported artifact in vehicle from place to place,evt109arg01transporter,,,,
434
+ movement.transportartifact.receiveimport,Transporter transported <arg2> in vehicle from place to place,,evt109arg02artifact,,,
435
+ movement.transportartifact.receiveimport,Transporter transported artifact in <arg3> from place to place,,,evt109arg03vehicle,,
436
+ movement.transportartifact.receiveimport,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt109arg04origin,
437
+ movement.transportartifact.receiveimport,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt109arg05destination
438
+ movement.transportartifact.sendsupplyexport,<arg1> transported artifact in vehicle from place to place,evt110arg01transporter,,,,
439
+ movement.transportartifact.sendsupplyexport,Transporter transported <arg2> in vehicle from place to place,,evt110arg02artifact,,,
440
+ movement.transportartifact.sendsupplyexport,Transporter transported artifact in <arg3> from place to place,,,evt110arg03vehicle,,
441
+ movement.transportartifact.sendsupplyexport,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt110arg04origin,
442
+ movement.transportartifact.sendsupplyexport,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt110arg05destination
443
+ movement.transportartifact.smuggleextract,<arg1> transported artifact in vehicle from place to place,evt111arg01transporter,,,,
444
+ movement.transportartifact.smuggleextract,Transporter transported <arg2> in vehicle from place to place,,evt111arg02artifact,,,
445
+ movement.transportartifact.smuggleextract,Transporter transported artifact in <arg3> from place to place,,,evt111arg03vehicle,,
446
+ movement.transportartifact.smuggleextract,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt111arg04origin,
447
+ movement.transportartifact.smuggleextract,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt111arg05destination
448
+ movement.transportperson.unspecified,<arg1> transported artifact in vehicle from place to place,evt112arg01transporter,,,,
449
+ movement.transportperson.unspecified,Transporter transported <arg2> in vehicle from place to place,,evt112arg02passenger,,,
450
+ movement.transportperson.unspecified,Transporter transported artifact in <arg3> from place to place,,,evt112arg03vehicle,,
451
+ movement.transportperson.unspecified,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt112arg04origin,
452
+ movement.transportperson.unspecified,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt112arg05destination
453
+ movement.transportperson.bringcarryunload,<arg1> transported artifact in vehicle from place to place,evt113arg01transporter,,,,
454
+ movement.transportperson.bringcarryunload,Transporter transported <arg2> in vehicle from place to place,,evt113arg02passenger,,,
455
+ movement.transportperson.bringcarryunload,Transporter transported artifact in <arg3> from place to place,,,evt113arg03vehicle,,
456
+ movement.transportperson.bringcarryunload,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt113arg04origin,
457
+ movement.transportperson.bringcarryunload,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt113arg05destination
458
+ movement.transportperson.disperseseparate,<arg1> transported artifact in vehicle from place to place,evt114arg01transporter,,,,
459
+ movement.transportperson.disperseseparate,Transporter transported <arg2> in vehicle from place to place,,evt114arg02passenger,,,
460
+ movement.transportperson.disperseseparate,Transporter transported artifact in <arg3> from place to place,,,evt114arg03vehicle,,
461
+ movement.transportperson.disperseseparate,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt114arg04origin,
462
+ movement.transportperson.disperseseparate,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt114arg05destination
463
+ movement.transportperson.evacuationrescue,<arg1> transported artifact in vehicle from place to place,evt115arg01transporter,,,,
464
+ movement.transportperson.evacuationrescue,Transporter transported <arg2> in vehicle from place to place,,evt115arg02passenger,,,
465
+ movement.transportperson.evacuationrescue,Transporter transported artifact in <arg3> from place to place,,,evt115arg03vehicle,,
466
+ movement.transportperson.evacuationrescue,Transporter transported artifact in vehicle from <arg4> place to place,,,,evt115arg04origin,
467
+ movement.transportperson.evacuationrescue,Transporter transported artifact in vehicle from place to <arg5> place,,,,,evt115arg05destination
468
+ movement.transportperson.fall,<arg1> fell from place to place,evt116arg01passenger,,,,
469
+ movement.transportperson.fall,Artifact fell from <arg2> place to place,,evt116arg02origin,,,
470
+ movement.transportperson.fall,Artifact fell from place to <arg3> place,,,evt116arg03destination,,
471
+ movement.transportperson.grantentryasylum,<arg1> grants entry to transporter transporting passenger from place to place,evt117arg01granter,,,,
472
+ movement.transportperson.grantentryasylum,Granter grants entry to <arg2> transporting passenger from place to place,,evt117arg02transporter,,,
473
+ movement.transportperson.grantentryasylum,Granter grants entry to transporter transporting <arg3> from place to place,,,evt117arg03passenger,,
474
+ movement.transportperson.grantentryasylum,Granter grants entry to transporter transporting passenger from <arg4> place to place,,,,evt117arg04origin,
475
+ movement.transportperson.grantentryasylum,Granter grants entry to transporter transporting passenger from place to <arg5> place,,,,,evt117arg05destination
476
+ movement.transportperson.hide,<arg1> concealed artifact in place transported in vehicle from place,evt118arg01transporter,,,,
477
+ movement.transportperson.hide,Transporter concealed <arg2> in place transported in vehicle from place,,evt118arg02passenger,,,
478
+ movement.transportperson.hide,Transporter concealed artifact in <arg3> place transported in vehicle from place,,,evt118arg03hidingplace,,
479
+ movement.transportperson.hide,Transporter concealed artifact in place transported in <arg4> vehicle from place,,,,evt118arg04vehicle,
480
+ movement.transportperson.hide,Transporter concealed artifact in place transported in vehicle from <arg5> place,,,,,evt118arg05origin
481
+ movement.transportperson.prevententry,<arg1> prevents transporter from transporting artifact from place to place,evt119arg01preventer,,,,
482
+ movement.transportperson.prevententry,Preventer prevents <arg2> from transporting artifact from place to place,,evt119arg02transporter,,,
483
+ movement.transportperson.prevententry,Preventer prevents transporter from transporting <arg3> from place to place,,,evt119arg03passenger,,
484
+ movement.transportperson.prevententry,Preventer prevents transporter from transporting artifact from <arg4> place to place,,,,evt119arg04origin,
485
+ movement.transportperson.prevententry,Preventer prevents transporter from transporting artifact from place to <arg5> place,,,,,evt119arg05destination
486
+ movement.transportperson.preventexit,<arg1> prevents transporter from transporting artifact from place to place,evt120arg01preventer,,,,
487
+ movement.transportperson.preventexit,Preventer prevents <arg2> from transporting artifact from place to place,,evt120arg02transporter,,,
488
+ movement.transportperson.preventexit,Preventer prevents transporter from transporting <arg3> from place to place,,,evt120arg03passenger,,
489
+ movement.transportperson.preventexit,Preventer prevents transporter from transporting artifact from <arg4> place to place,,,,evt120arg04origin,
490
+ movement.transportperson.preventexit,Preventer prevents transporter from transporting artifact from place to <arg5> place,,,,,evt120arg05destination
491
+ movement.transportperson.selfmotion,<arg1> moved in vehicle from place to place,evt121arg01transporter,,,,
492
+ movement.transportperson.selfmotion,Transporter moved in <arg2> from place to place,,evt121arg02vehicle,,,
493
+ movement.transportperson.selfmotion,Transporter moved in vehicle from <arg3> place to place,,,evt121arg03origin,,
494
+ movement.transportperson.selfmotion,Transporter moved in vehicle from place to <arg4> place,,,,evt121arg04destination,
495
+ movement.transportperson.smuggleextract,<arg1> transported passenger in vehicle from place to place,evt122arg01transporter,,,,
496
+ movement.transportperson.smuggleextract,Transporter transported <arg2> in vehicle from place to place,,evt122arg02passenger,,,
497
+ movement.transportperson.smuggleextract,Transporter transported passenger in <arg3> from place to place,,,evt122arg03vehicle,,
498
+ movement.transportperson.smuggleextract,Transporter transported passenger in vehicle from <arg4> place to place,,,,evt122arg04origin,
499
+ movement.transportperson.smuggleextract,Transporter transported passenger in vehicle from place to <arg5> place,,,,,evt122arg05destination
500
+ personnel.elect.unspecified,<arg1> elected candidate in place,evt123arg01voter,,,,
501
+ personnel.elect.unspecified,Voter elected <arg2> in place,,evt123arg02candidate,,,
502
+ personnel.elect.unspecified,Voter elected candidate in <arg3> place,,,evt123arg03place,,
503
+ personnel.elect.winelection,<arg1> elected candidate in place,evt124arg01voter,,,,
504
+ personnel.elect.winelection,Voter elected <arg2> in place,,evt124arg02candidate,,,
505
+ personnel.elect.winelection,Voter elected candidate in <arg3> place,,,evt124arg03place,,
506
+ personnel.endposition.unspecified,<arg1> stopped working at place of employment in place,evt125arg01employee,,,,
507
+ personnel.endposition.unspecified,Employee stopped working at <arg2> in place,,evt125arg02placeofemployment,,,
508
+ personnel.endposition.unspecified,Employee stopped working at place of employment in <arg3> place,,,evt125arg03place,,
509
+ personnel.endposition.firinglayoff,<arg1> stopped working at place of employment in place,evt126arg01employee,,,,
510
+ personnel.endposition.firinglayoff,Employee stopped working at <arg2> in place,,evt126arg02placeofemployment,,,
511
+ personnel.endposition.firinglayoff,Employee stopped working at place of employment in <arg3> place,,,evt126arg03place,,
512
+ personnel.endposition.quitretire,<arg1> stopped working at place of employment in place,evt127arg01employee,,,,
513
+ personnel.endposition.quitretire,Employee stopped working at <arg2> in place,,evt127arg02placeofemployment,,,
514
+ personnel.endposition.quitretire,Employee stopped working at place of employment in <arg3> place,,,evt127arg03place,,
515
+ personnel.startposition.unspecified,<arg1> started working at place of employment in place,evt128arg01employee,,,,
516
+ personnel.startposition.unspecified,Employee started working at <arg2> in place,,evt128arg02placeofemployment,,,
517
+ personnel.startposition.unspecified,Employee started working at place of employment in <arg3> place,,,evt128arg03place,,
518
+ personnel.startposition.hiring,<arg1> started working at place of employment in place,evt129arg01employee,,,,
519
+ personnel.startposition.hiring,Employee started working at <arg2> in place,,evt129arg02placeofemployment,,,
520
+ personnel.startposition.hiring,Employee started working at place of employment in <arg3> place,,,evt129arg03place,,
521
+ transaction.transaction.unspecified,A transaction occurred between <arg1> and participant for the benefit of beneficiary at place,evt130arg01participant,,,,
522
+ transaction.transaction.unspecified,A transaction occurred between participant and <arg2> for the benefit of beneficiary at place,,evt130arg02participant,,,
523
+ transaction.transaction.unspecified,A transaction occurred between participant and participant for the benefit of <arg3> at place,,,evt130arg03beneficiary,,
524
+ transaction.transaction.unspecified,A transaction occurred between participant and participant for the benefit of beneficiary at <arg4> place,,,,evt130arg04place,
525
+ transaction.transaction.embargosanction,<arg1> prevented giver from giving artifact money to recipient at place,evt131arg01preventer,,,,
526
+ transaction.transaction.embargosanction,Preventer prevented <arg2> from giving artifact money to recipient at place,,evt131arg02giver,,,
527
+ transaction.transaction.embargosanction,Preventer prevented giver from giving artifact money to <arg3> at place,,,evt131arg03recipient,,
528
+ transaction.transaction.embargosanction,Preventer prevented giver from giving <arg4> to recipient at place,,,,evt131arg04artifactmoney,
529
+ transaction.transaction.embargosanction,Preventer prevented giver from giving artifact money to recipient at <arg5> place,,,,,evt131arg05place
530
+ transaction.transaction.giftgrantprovideaid,<arg1> gave something to recipient for the benefit of beneficiary at place,evt132arg01giver,,,,
531
+ transaction.transaction.giftgrantprovideaid,Giver gave something to <arg2> for the benefit of beneficiary at place,,evt132arg02recipient,,,
532
+ transaction.transaction.giftgrantprovideaid,Giver gave something to recipient for the benefit of <arg3> at place,,,evt132arg03beneficiary,,
533
+ transaction.transaction.giftgrantprovideaid,Giver gave something to recipient for the benefit of beneficiary at <arg4> place,,,,evt132arg04place,
534
+ transaction.transfermoney.unspecified,<arg1> gave money to recipient for the benefit of beneficiary at place,evt133arg01giver,,,,
535
+ transaction.transfermoney.unspecified,Giver gave money to <arg2> for the benefit of beneficiary at place,,evt133arg02recipient,,,
536
+ transaction.transfermoney.unspecified,Giver gave money to recipient for the benefit of <arg3> at place,,,evt133arg03beneficiary,,
537
+ transaction.transfermoney.unspecified,Giver gave <arg4> money to recipient for the benefit of beneficiary at place,,,,evt133arg04money,
538
+ transaction.transfermoney.unspecified,Giver gave money to recipient for the benefit of beneficiary at <arg5> place,,,,,evt133arg05place
539
+ transaction.transfermoney.borrowlend,<arg1> gave money to recipient for the benefit of beneficiary at place,evt134arg01giver,,,,
540
+ transaction.transfermoney.borrowlend,Giver gave money to <arg2> for the benefit of beneficiary at place,,evt134arg02recipient,,,
541
+ transaction.transfermoney.borrowlend,Giver gave money to recipient for the benefit of <arg3> at place,,,evt134arg03beneficiary,,
542
+ transaction.transfermoney.borrowlend,Giver gave <arg4> money to recipient for the benefit of beneficiary at place,,,,evt134arg04money,
543
+ transaction.transfermoney.borrowlend,Giver gave money to recipient for the benefit of beneficiary at <arg5> place,,,,,evt134arg05place
544
+ transaction.transfermoney.embargosanction,<arg1> prevented giver from giving artifact money to recipient at place,evt135arg01preventer,,,,
545
+ transaction.transfermoney.embargosanction,Preventer prevented <arg2> from giving artifact money to recipient at place,,evt135arg02giver,,,
546
+ transaction.transfermoney.embargosanction,Preventer prevented giver from giving artifact money to <arg3> at place,,,evt135arg03recipient,,
547
+ transaction.transfermoney.embargosanction,Preventer prevented giver from giving <arg4> to recipient at place,,,,evt135arg04money,
548
+ transaction.transfermoney.embargosanction,Preventer prevented giver from giving artifact money to recipient at <arg5> place,,,,,evt135arg05place
549
+ transaction.transfermoney.giftgrantprovideaid,<arg1> gave money to recipient for the benefit of beneficiary at place,evt136arg01giver,,,,
550
+ transaction.transfermoney.giftgrantprovideaid,Giver gave money to <arg2> for the benefit of beneficiary at place,,evt136arg02recipient,,,
551
+ transaction.transfermoney.giftgrantprovideaid,Giver gave money to recipient for the benefit of <arg3> at place,,,evt136arg03beneficiary,,
552
+ transaction.transfermoney.giftgrantprovideaid,Giver gave <arg4> money to recipient for the benefit of beneficiary at place,,,,evt136arg04money,
553
+ transaction.transfermoney.giftgrantprovideaid,Giver gave money to recipient for the benefit of beneficiary at <arg5> place,,,,,evt136arg05place
554
+ transaction.transfermoney.payforservice,<arg1> gave money to recipient for the benefit of beneficiary at place,evt137arg01giver,,,,
555
+ transaction.transfermoney.payforservice,Giver gave money to <arg2> for the benefit of beneficiary at place,,evt137arg02recipient,,,
556
+ transaction.transfermoney.payforservice,Giver gave money to recipient for the benefit of <arg3> at place,,,evt137arg03beneficiary,,
557
+ transaction.transfermoney.payforservice,Giver gave <arg4> money to recipient for the benefit of beneficiary at place,,,,evt137arg04money,
558
+ transaction.transfermoney.payforservice,Giver gave money to recipient for the benefit of beneficiary at <arg5> place,,,,,evt137arg05place
559
+ transaction.transfermoney.purchase,<arg1> gave money to recipient for the benefit of beneficiary at place,evt138arg01giver,,,,
560
+ transaction.transfermoney.purchase,Giver gave money to <arg2> for the benefit of beneficiary at place,,evt138arg02recipient,,,
561
+ transaction.transfermoney.purchase,Giver gave money to recipient for the benefit of <arg3> at place,,,evt138arg03beneficiary,,
562
+ transaction.transfermoney.purchase,Giver gave <arg4> money to recipient for the benefit of beneficiary at place,,,,evt138arg04money,
563
+ transaction.transfermoney.purchase,Giver gave money to recipient for the benefit of beneficiary at <arg5> place,,,,,evt138arg05place
564
+ transaction.transferownership.unspecified,<arg1> gave artifact to recipient for the benefit of beneficiary at place,evt139arg01giver,,,,
565
+ transaction.transferownership.unspecified,Giver gave artifact to <arg2> for the benefit of beneficiary at place,,evt139arg02recipient,,,
566
+ transaction.transferownership.unspecified,Giver gave artifact to recipient for the benefit of <arg3> at place,,,evt139arg03beneficiary,,
567
+ transaction.transferownership.unspecified,Giver gave <arg4> to recipient for the benefit of beneficiary at place,,,,evt139arg04artifact,
568
+ transaction.transferownership.unspecified,Giver gave artifact to recipient for the benefit of beneficiary at <arg5> place,,,,,evt139arg05place
569
+ transaction.transferownership.borrowlend,<arg1> gave artifact to recipient for the benefit of beneficiary at place,evt140arg01giver,,,,
570
+ transaction.transferownership.borrowlend,Giver gave artifact to <arg2> for the benefit of beneficiary at place,,evt140arg02recipient,,,
571
+ transaction.transferownership.borrowlend,Giver gave artifact to recipient for the benefit of <arg3> at place,,,evt140arg03beneficiary,,
572
+ transaction.transferownership.borrowlend,Giver gave <arg4> to recipient for the benefit of beneficiary at place,,,,evt140arg04artifact,
573
+ transaction.transferownership.borrowlend,Giver gave artifact to recipient for the benefit of beneficiary at <arg5> place,,,,,evt140arg05place
574
+ transaction.transferownership.embargosanction,<arg1> prevented giver from giving artifact money to recipient at place,evt141arg01preventer,,,,
575
+ transaction.transferownership.embargosanction,Preventer prevented <arg2> from giving artifact money to recipient at place,,evt141arg02giver,,,
576
+ transaction.transferownership.embargosanction,Preventer prevented giver from giving artifact money to <arg3> at place,,,evt141arg03recipient,,
577
+ transaction.transferownership.embargosanction,Preventer prevented giver from giving <arg4> to recipient at place,,,,evt141arg04artifact,
578
+ transaction.transferownership.embargosanction,Preventer prevented giver from giving artifact money to recipient at <arg5> place,,,,,evt141arg05place
579
+ transaction.transferownership.giftgrantprovideaid,<arg1> gave artifact to recipient for the benefit of beneficiary at place,evt142arg01giver,,,,
580
+ transaction.transferownership.giftgrantprovideaid,Giver gave artifact to <arg2> for the benefit of beneficiary at place,,evt142arg02recipient,,,
581
+ transaction.transferownership.giftgrantprovideaid,Giver gave artifact to recipient for the benefit of <arg3> at place,,,evt142arg03beneficiary,,
582
+ transaction.transferownership.giftgrantprovideaid,Giver gave <arg4> to recipient for the benefit of beneficiary at place,,,,evt142arg04artifact,
583
+ transaction.transferownership.giftgrantprovideaid,Giver gave artifact to recipient for the benefit of beneficiary at <arg5> place,,,,,evt142arg05place
584
+ transaction.transferownership.purchase,<arg1> gave artifact to recipient for the benefit of beneficiary at place,evt143arg01giver,,,,
585
+ transaction.transferownership.purchase,Giver gave artifact to <arg2> for the benefit of beneficiary at place,,evt143arg02recipient,,,
586
+ transaction.transferownership.purchase,Giver gave artifact to recipient for the benefit of <arg3> at place,,,evt143arg03beneficiary,,
587
+ transaction.transferownership.purchase,Giver gave <arg4> to recipient for the benefit of beneficiary at place,,,,evt143arg04artifact,
588
+ transaction.transferownership.purchase,Giver gave artifact to recipient for the benefit of beneficiary at <arg5> place,,,,,evt143arg05place
589
+ transaction.transaction.transfercontrol,<arg1> transferred control of something to recipient for the benefit of beneficiary in place,evt144arg01giver,,,,
590
+ transaction.transaction.transfercontrol,Giver transferred control of something to <arg2> for the benefit of beneficiary in place,,evt144arg02recipient,,,
591
+ transaction.transaction.transfercontrol,Giver transferred control of something to recipient for the benefit of <arg3> in place,,,evt144arg03beneficiary,,
592
+ transaction.transaction.transfercontrol,Giver transferred control of <arg4> to recipient for the benefit of beneficiary in place,,,,evt144arg04territoryorfacility,
593
+ transaction.transaction.transfercontrol,Giver transferred control of something to recipient for the benefit of beneficiary in <arg5> place,,,,,evt144arg05place
aida_ontology_new.csv DELETED
@@ -1,150 +0,0 @@
1
- event_type,template,arg1,arg2,arg3,arg4,arg5
2
- artifactexistence.artifactfailure.mechanicalfailure,what is the <arg> in <trg>,evt152arg01mechanicalartifact ,evt152arg02instrument ,evt152arg03place ,,
3
- artifactexistence.damagedestroy.unspecified,what is the <arg> in <trg>,evt001arg01damagerdestroyer,evt001arg02artifact,evt001arg03instrument,evt001arg04place,
4
- artifactexistence.damagedestroy.damage,what is the <arg> in <trg>,evt002arg01damager,evt002arg02artifact,evt002arg03instrument,evt002arg04place,
5
- artifactexistence.damagedestroy.destroy,what is the <arg> in <trg>,evt003arg01destroyer,evt003arg02artifact,evt003arg03instrument,evt003arg04place,
6
- artifactexistence.shortage.shortage,what is the <arg> in <trg>,evt149arg01experiencer ,evt149arg02supply ,evt149arg03place ,,
7
- conflict.attack.unspecified,what is the <arg> in <trg>,evt004arg01attacker,evt004arg02target,evt004arg03instrument,evt004arg04place,
8
- conflict.attack.airstrikemissilestrike,what is the <arg> in <trg>,evt005arg01attacker,evt005arg02target,evt005arg03instrument,evt005arg04place,
9
- conflict.attack.biologicalchemicalpoisonattack,what is the <arg> in <trg>,evt006arg01attacker,evt006arg02target,evt006arg03instrument,evt006arg04place,
10
- conflict.attack.bombing,what is the <arg> in <trg>,evt007arg01attacker,evt007arg02target,evt007arg03instrument,evt007arg04place,
11
- conflict.attack.firearmattack,what is the <arg> in <trg>,evt008arg01attacker,evt008arg02target,evt008arg03instrument,evt008arg04place,
12
- conflict.attack.hanging,what is the <arg> in <trg>,evt009arg01attacker,evt009arg02target,evt009arg03instrument,evt009arg04place,
13
- conflict.attack.invade,what is the <arg> in <trg>,evt010arg01attacker,evt010arg02target,evt010arg03instrument,evt010arg04place,
14
- conflict.attack.selfdirectedbattle,what is the <arg> in <trg>,evt011arg01attacker,evt011arg02target,evt011arg03instrument,evt011arg04place,
15
- conflict.attack.setfire,what is the <arg> in <trg>,evt012arg01attacker,evt012arg02target,evt012arg03instrument,evt012arg04place,
16
- conflict.attack.stabbing,what is the <arg> in <trg>,evt013arg01attacker,evt013arg02target,evt013arg03instrument,evt013arg04place,
17
- conflict.attack.stealrobhijack,what is the <arg> in <trg>,evt014arg01attacker,evt014arg02target,evt014arg03instrument,evt014arg04place,evt014arg05artifact
18
- conflict.attack.strangling,what is the <arg> in <trg>,evt015arg01attacker,evt015arg02target,evt015arg03instrument,evt015arg04place,
19
- conflict.coup.coup,what is the <arg> in <trg>,evt151arg01deposedentity ,evt151arg02deposingentity ,evt151arg03place ,,
20
- conflict.demonstrate.unspecified,what is the <arg> in <trg>,evt016arg01demonstrator,evt016arg02place,,,
21
- conflict.demonstrate.marchprotestpoliticalgathering,what is the <arg> in <trg>,evt017arg01demonstrator,evt017arg02place,,,
22
- conflict.yield.unspecified,what is the <arg> in <trg>,evt018arg01yielder,evt018arg02recipient,evt018arg03place,,
23
- conflict.yield.retreat,what is the <arg> in <trg>,evt019arg01retreater,evt019arg02origin,evt019arg03destination,,
24
- conflict.yield.surrender,what is the <arg> in <trg>,evt020arg01surrenderer,evt020arg02recipient,evt020arg03place,,
25
- contact.collaborate.unspecified,what is the <arg> in <trg>,evt021arg01participant,evt021arg02participant,evt021arg03place,,
26
- contact.collaborate.correspondence,what is the <arg> in <trg>,evt022arg01participant,evt022arg02participant,evt022arg03place,,
27
- contact.collaborate.meet,what is the <arg> in <trg>,evt023arg01participant,evt023arg02participant,evt023arg03place,,
28
- contact.commandorder.unspecified,what is the <arg> in <trg>,evt024arg01communicator,evt024arg02recipient,evt024arg03place,evt024arg04topic,
29
- contact.commandorder.broadcast,what is the <arg> in <trg>,evt025arg01communicator,evt025arg02recipient,evt025arg03place,evt025arg04topic,
30
- contact.commandorder.correspondence,what is the <arg> in <trg>,evt026arg01communicator,evt026arg02recipient,evt026arg03place,evt026arg04topic,
31
- contact.commandorder.meet,what is the <arg> in <trg>,evt027arg01communicator,evt027arg02recipient,evt027arg03place,evt027arg04topic,
32
- contact.commitmentpromiseexpressintent.unspecified,what is the <arg> in <trg>,evt028arg01communicator,evt028arg02recipient,evt028arg03place,evt028arg04topic,
33
- contact.commitmentpromiseexpressintent.broadcast,what is the <arg> in <trg>,evt029arg01communicator,evt029arg02recipient,evt029arg03place,evt029arg04topic,
34
- contact.commitmentpromiseexpressintent.correspondence,what is the <arg> in <trg>,evt030arg01communicator,evt030arg02recipient,evt030arg03place,evt030arg04topic,
35
- contact.commitmentpromiseexpressintent.meet,what is the <arg> in <trg>,evt031arg01communicator,evt031arg02recipient,evt031arg03place,evt031arg04topic,
36
- contact.discussion.unspecified,what is the <arg> in <trg>,evt032arg01participant,evt032arg02participant,evt032arg03place,,
37
- contact.discussion.correspondence,what is the <arg> in <trg>,evt033arg01participant,evt033arg02participant,evt033arg03place,,
38
- contact.discussion.meet,what is the <arg> in <trg>,evt034arg01participant,evt034arg02participant,evt034arg03place,,
39
- contact.funeralvigil.unspecified,what is the <arg> in <trg>,evt035arg01participant,evt035arg02participant,evt035arg03deceased,evt035arg04place,
40
- contact.funeralvigil.meet,what is the <arg> in <trg>,evt036arg01participant,evt036arg02participant,evt036arg03deceased,evt036arg04place,
41
- contact.mediastatement.unspecified,what is the <arg> in <trg>,evt037arg01communicator,evt037arg02recipient,evt037arg03place,,
42
- contact.mediastatement.broadcast,what is the <arg> in <trg>,evt038arg01communicator,evt038arg02recipient,evt038arg03place,,
43
- contact.negotiate.unspecified,what is the <arg> in <trg>,evt039arg01participant,evt039arg02participant,evt039arg03place,evt039arg04topic,
44
- contact.negotiate.correspondence,what is the <arg> in <trg>,evt040arg01participant,evt040arg02participant,evt040arg03place,evt040arg04topic,
45
- contact.negotiate.meet,what is the <arg> in <trg>,evt041arg01participant,evt041arg02participant,evt041arg03place,evt041arg04topic,
46
- contact.prevarication.unspecified,what is the <arg> in <trg>,evt042arg01communicator,evt042arg02recipient,evt042arg03place,evt042arg04topic,
47
- contact.prevarication.broadcast,what is the <arg> in <trg>,evt043arg01communicator,evt043arg02recipient,evt043arg03place,evt043arg04topic,
48
- contact.prevarication.correspondence,what is the <arg> in <trg>,evt044arg01communicator,evt044arg02recipient,evt044arg03place,evt044arg04topic,
49
- contact.prevarication.meet,what is the <arg> in <trg>,evt045arg01communicator,evt045arg02recipient,evt045arg03place,evt045arg04topic,
50
- contact.publicstatementinperson.unspecified,what is the <arg> in <trg>,evt046arg01communicator,evt046arg02recipient,evt046arg03place,,
51
- contact.publicstatementinperson.broadcast,what is the <arg> in <trg>,evt047arg01communicator,evt047arg02recipient,evt047arg03place,,
52
- contact.requestadvise.unspecified,what is the <arg> in <trg>,evt048arg01communicator,evt048arg02recipient,evt048arg03place,evt048arg04topic,
53
- contact.requestadvise.broadcast,what is the <arg> in <trg>,evt049arg01communicator,evt049arg02recipient,evt049arg03place,evt049arg04topic,
54
- contact.requestadvise.correspondence,what is the <arg> in <trg>,evt050arg01communicator,evt050arg02recipient,evt050arg03place,evt050arg04topic,
55
- contact.requestadvise.meet,what is the <arg> in <trg>,evt051arg01communicator,evt051arg02recipient,evt051arg03place,evt051arg04topic,
56
- contact.threatencoerce.unspecified,what is the <arg> in <trg>,evt052arg01communicator,evt052arg02recipient,evt052arg03place,evt052arg04topic,
57
- contact.threatencoerce.broadcast,what is the <arg> in <trg>,evt053arg01communicator,evt053arg02recipient,evt053arg03place,evt053arg04topic,
58
- contact.threatencoerce.correspondence,what is the <arg> in <trg>,evt054arg01communicator,evt054arg02recipient,evt054arg03place,evt054arg04topic,
59
- contact.threatencoerce.meet,what is the <arg> in <trg>,evt055arg01communicator,evt055arg02recipient,evt055arg03place,evt055arg04topic,
60
- disaster.accidentcrash.accidentcrash,what is the <arg> in <trg>,evt057arg01driverpassenger,evt057arg02vehicle,evt057arg03crashobject,evt057arg04place,
61
- disaster.diseaseoutbreak.diseaseoutbreak,what is the <arg> in <trg>,evt148arg01disease ,evt148arg02victim ,evt148arg03place ,,
62
- disaster.fireexplosion.fireexplosion,what is the <arg> in <trg>,evt059arg01fireexplosionobject,evt059arg02instrument,evt059arg03place,,
63
- genericcrime.genericcrime.genericcrime,what is the <arg> in <trg>,evt154arg01perpetrator ,evt154arg02victim ,evt154arg03place ,,
64
- government.agreements.unspecified,what is the <arg> in <trg>,evt060arg01participant,evt060arg02participant,evt060arg03place,,
65
- government.agreements.acceptagreementcontractceasefire,what is the <arg> in <trg>,evt061arg01participant,evt061arg02participant,evt061arg03place,,
66
- government.agreements.rejectnullifyagreementcontractceasefire,what is the <arg> in <trg>,evt062arg01rejecternullifier,evt062arg02otherparticipant,evt062arg03place,,
67
- government.agreements.violateagreement,what is the <arg> in <trg>,evt063arg01violator,evt063arg02otherparticipant,evt063arg03place,,
68
- government.convene.convene,what is the <arg> in <trg>,evt145arg01convener ,evt145arg02convenedthing ,evt145arg03place ,,
69
- government.formation.unspecified,what is the <arg> in <trg>,evt064arg01gpe,evt064arg02founder,evt064arg03place,,
70
- government.formation.mergegpe,what is the <arg> in <trg>,evt065arg01participant,evt065arg02participant,evt065arg03place,,
71
- government.formation.startgpe,what is the <arg> in <trg>,evt066arg01gpe,evt066arg02founder,evt066arg03place,,
72
- government.legislate.legislate,what is the <arg> in <trg>,evt068arg01governmentbody,evt068arg02law,evt068arg03place,,
73
- government.spy.spy,what is the <arg> in <trg>,evt070arg01spy,evt070arg02observedentity,evt070arg03beneficiary,evt070arg04place,
74
- government.vote.unspecified,what is the <arg> in <trg>,evt071arg01voter,evt071arg02candidate,evt071arg03ballot,evt071arg04result,evt071arg05place
75
- government.vote.castvote,what is the <arg> in <trg>,evt072arg01voter,evt072arg02candidate,evt072arg03ballot,evt072arg04result,evt072arg05place
76
- government.vote.violationspreventvote,what is the <arg> in <trg>,evt073arg01preventer,evt073arg02voter,evt073arg03candidate,evt073arg04ballot,evt073arg05place
77
- inspection.sensoryobserve.unspecified,what is the <arg> in <trg>,evt074arg01observer,evt074arg02observedentity,evt074arg03place,,
78
- inspection.sensoryobserve.inspectpeopleorganization,what is the <arg> in <trg>,evt075arg01inspector,evt075arg02inspectedentity,evt075arg03place,,
79
- inspection.sensoryobserve.monitorelection,what is the <arg> in <trg>,evt076arg01monitor,evt076arg02monitoredentity,evt076arg03place,,
80
- inspection.sensoryobserve.physicalinvestigateinspect,what is the <arg> in <trg>,evt077arg01inspector,evt077arg02inspectedentity,evt077arg03place,,
81
- inspection.targetaimat.targetaimat,what is the <arg> in <trg>,evt153arg01targeter ,evt153arg02target ,evt153arg03instrument ,evt153arg04place ,
82
- justice.arrestjaildetain.arrestjaildetain,what is the <arg> in <trg>,evt079arg01jailer,evt079arg02detainee,evt079arg03crime,evt079arg04place,
83
- justice.initiatejudicialprocess.unspecified,what is the <arg> in <trg>,evt080arg01prosecutor,evt080arg02defendant,evt080arg03judgecourt,evt080arg04crime,evt080arg05place
84
- justice.initiatejudicialprocess.chargeindict,what is the <arg> in <trg>,evt081arg01prosecutor,evt081arg02defendant,evt081arg03judgecourt,evt081arg04crime,evt081arg05place
85
- justice.initiatejudicialprocess.trialhearing,what is the <arg> in <trg>,evt082arg01prosecutor,evt082arg02defendant,evt082arg03judgecourt,evt082arg04crime,evt082arg05place
86
- justice.investigate.unspecified,what is the <arg> in <trg>,evt083arg01investigator,evt083arg02defendant,evt083arg03place,,
87
- justice.investigate.investigatecrime,what is the <arg> in <trg>,evt084arg01investigator,evt084arg02defendant,evt084arg03crime,evt084arg04place,
88
- justice.judicialconsequences.unspecified,what is the <arg> in <trg>,evt085arg01judgecourt,evt085arg02defendant,evt085arg03crime,evt085arg04place,
89
- justice.judicialconsequences.convict,what is the <arg> in <trg>,evt086arg01judgecourt,evt086arg02defendant,evt086arg03crime,evt086arg04place,
90
- justice.judicialconsequences.execute,what is the <arg> in <trg>,evt087arg01executioner,evt087arg02defendant,evt087arg03crime,evt087arg04place,
91
- justice.judicialconsequences.extradite,what is the <arg> in <trg>,evt088arg01extraditer,evt088arg02defendant,evt088arg03crime,evt088arg04origin,evt088arg05destination
92
- life.die.unspecified,what is the <arg> in <trg>,evt089arg01victim,evt089arg02place,evt089arg03killer,evt089arg04medicalissue,
93
- life.die.deathcausedbyviolentevents,what is the <arg> in <trg>,evt090arg01killer,evt090arg02victim,evt090arg03instrument,evt090arg04place,evt090arg05medicalissue
94
- life.die.nonviolentdeath,what is the <arg> in <trg>,evt091arg01victim,evt091arg02place,evt091arg03killer,evt091arg04medicalissue,
95
- life.injure.unspecified,what is the <arg> in <trg>,evt092arg01victim,evt092arg02injurer,evt092arg03place,evt092arg04medicalissue,
96
- life.injure.illnessdegradationhungerthirst,what is the <arg> in <trg>,evt093arg01victim,evt093arg02place,evt093arg03injurer,evt093arg04medicalissue,
97
- life.injure.illnessdegradationphysical,what is the <arg> in <trg>,evt094arg01victim,evt094arg02place,evt094arg03injurer,evt094arg04medicalissue,
98
- life.injure.illnessdegredationsickness,what is the <arg> in <trg>,evt150arg01victim ,evt150arg02injurer ,evt150arg03disease ,evt150arg04place ,
99
- life.injure.injurycausedbyviolentevents,what is the <arg> in <trg>,evt095arg01injurer,evt095arg02victim,evt095arg03instrument,evt095arg04place,evt095arg05medicalissue
100
- manufacture.artifact.unspecified,what is the <arg> in <trg>,evt096arg01manufacturer,evt096arg02artifact,evt096arg03instrument,evt096arg04place,
101
- manufacture.artifact.build,what is the <arg> in <trg>,evt097arg01manufacturer,evt097arg02artifact,evt097arg03instrument,evt097arg04place,
102
- manufacture.artifact.createintellectualproperty,what is the <arg> in <trg>,evt098arg01manufacturer,evt098arg02artifact,evt098arg03instrument,evt098arg04place,
103
- manufacture.artifact.createmanufacture,what is the <arg> in <trg>,evt099arg01manufacturer,evt099arg02artifact,evt099arg03instrument,evt099arg04place,
104
- medical.intervention.intervention,what is the <arg> in <trg>,evt147arg01treater ,evt147arg02patient ,evt147arg03medicalissue ,evt147arg04instrument ,evt147arg05place
105
- movement.transportartifact.unspecified,what is the <arg> in <trg>,evt100arg01transporter,evt100arg02artifact,evt100arg03vehicle,evt100arg04origin,evt100arg05destination
106
- movement.transportartifact.bringcarryunload,what is the <arg> in <trg>,evt101arg01transporter,evt101arg02artifact,evt101arg03vehicle,evt101arg04origin,evt101arg05destination
107
- movement.transportartifact.disperseseparate,what is the <arg> in <trg>,evt102arg01transporter,evt102arg02artifact,evt102arg03vehicle,evt102arg04origin,evt102arg05destination
108
- movement.transportartifact.fall,what is the <arg> in <trg>,evt103arg01artifact,evt103arg02origin,evt103arg03destination,,
109
- movement.transportartifact.grantentry,what is the <arg> in <trg>,evt104arg01transporter,evt104arg02artifact,evt104arg03origin,evt104arg04destination,
110
- movement.transportartifact.hide,what is the <arg> in <trg>,evt105arg01transporter,evt105arg02artifact,evt105arg03hidingplace,evt105arg04vehicle,evt105arg05origin
111
- movement.transportartifact.lossofcontrol,what is the <arg> in <trg>,evt146arg01controller ,evt146arg02controlledthing ,evt146arg03place ,,
112
- movement.transportartifact.nonviolentthrowlaunch,what is the <arg> in <trg>,evt106arg01transporter,evt106arg02artifact,evt106arg03vehicle,evt106arg04origin,evt106arg05destination
113
- movement.transportartifact.prevententry,what is the <arg> in <trg>,evt107arg01preventer,evt107arg02transporter,evt107arg03artifact,evt107arg04origin,evt107arg05destination
114
- movement.transportartifact.preventexit,what is the <arg> in <trg>,evt108arg01preventer,evt108arg02transporter,evt108arg03artifact,evt108arg04origin,evt108arg05destination
115
- movement.transportartifact.receiveimport,what is the <arg> in <trg>,evt109arg01transporter,evt109arg02artifact,evt109arg03vehicle,evt109arg04origin,evt109arg05destination
116
- movement.transportartifact.sendsupplyexport,what is the <arg> in <trg>,evt110arg01transporter,evt110arg02artifact,evt110arg03vehicle,evt110arg04origin,evt110arg05destination
117
- movement.transportartifact.smuggleextract,what is the <arg> in <trg>,evt111arg01transporter,evt111arg02artifact,evt111arg03vehicle,evt111arg04origin,evt111arg05destination
118
- movement.transportperson.unspecified,what is the <arg> in <trg>,evt112arg01transporter,evt112arg02passenger,evt112arg03vehicle,evt112arg04origin,evt112arg05destination
119
- movement.transportperson.bringcarryunload,what is the <arg> in <trg>,evt113arg01transporter,evt113arg02passenger,evt113arg03vehicle,evt113arg04origin,evt113arg05destination
120
- movement.transportperson.disperseseparate,what is the <arg> in <trg>,evt114arg01transporter,evt114arg02passenger,evt114arg03vehicle,evt114arg04origin,evt114arg05destination
121
- movement.transportperson.evacuationrescue,what is the <arg> in <trg>,evt115arg01transporter,evt115arg02passenger,evt115arg03vehicle,evt115arg04origin,evt115arg05destination
122
- movement.transportperson.fall,what is the <arg> in <trg>,evt116arg01passenger,evt116arg02origin,evt116arg03destination,,
123
- movement.transportperson.grantentryasylum,what is the <arg> in <trg>,evt117arg01granter,evt117arg02transporter,evt117arg03passenger,evt117arg04origin,evt117arg05destination
124
- movement.transportperson.hide,what is the <arg> in <trg>,evt118arg01transporter,evt118arg02passenger,evt118arg03hidingplace,evt118arg04vehicle,evt118arg05origin
125
- movement.transportperson.prevententry,what is the <arg> in <trg>,evt119arg01preventer,evt119arg02transporter,evt119arg03passenger,evt119arg04origin,evt119arg05destination
126
- movement.transportperson.preventexit,what is the <arg> in <trg>,evt120arg01preventer,evt120arg02transporter,evt120arg03passenger,evt120arg04origin,evt120arg05destination
127
- movement.transportperson.selfmotion,what is the <arg> in <trg>,evt121arg01transporter,evt121arg02vehicle,evt121arg03origin,evt121arg04destination,
128
- movement.transportperson.smuggleextract,what is the <arg> in <trg>,evt122arg01transporter,evt122arg02passenger,evt122arg03vehicle,evt122arg04origin,evt122arg05destination
129
- personnel.elect.unspecified,what is the <arg> in <trg>,evt123arg01voter,evt123arg02candidate,evt123arg03place,,
130
- personnel.elect.winelection,what is the <arg> in <trg>,evt124arg01voter,evt124arg02candidate,evt124arg03place,,
131
- personnel.endposition.unspecified,what is the <arg> in <trg>,evt125arg01employee,evt125arg02placeofemployment,evt125arg03place,,
132
- personnel.endposition.firinglayoff,what is the <arg> in <trg>,evt126arg01employee,evt126arg02placeofemployment,evt126arg03place,,
133
- personnel.endposition.quitretire,what is the <arg> in <trg>,evt127arg01employee,evt127arg02placeofemployment,evt127arg03place,,
134
- personnel.startposition.unspecified,what is the <arg> in <trg>,evt128arg01employee,evt128arg02placeofemployment,evt128arg03place,,
135
- personnel.startposition.hiring,what is the <arg> in <trg>,evt129arg01employee,evt129arg02placeofemployment,evt129arg03place,,
136
- transaction.transaction.unspecified,what is the <arg> in <trg>,evt130arg01participant,evt130arg02participant,evt130arg03beneficiary,evt130arg04place,
137
- transaction.transaction.embargosanction,what is the <arg> in <trg>,evt131arg01preventer,evt131arg02giver,evt131arg03recipient,evt131arg04artifactmoney,evt131arg05place
138
- transaction.transaction.giftgrantprovideaid,what is the <arg> in <trg>,evt132arg01giver,evt132arg02recipient,evt132arg03beneficiary,evt132arg04place,
139
- transaction.transfermoney.unspecified,what is the <arg> in <trg>,evt133arg01giver,evt133arg02recipient,evt133arg03beneficiary,evt133arg04money,evt133arg05place
140
- transaction.transfermoney.borrowlend,what is the <arg> in <trg>,evt134arg01giver,evt134arg02recipient,evt134arg03beneficiary,evt134arg04money,evt134arg05place
141
- transaction.transfermoney.embargosanction,what is the <arg> in <trg>,evt135arg01preventer,evt135arg02giver,evt135arg03recipient,evt135arg04money,evt135arg05place
142
- transaction.transfermoney.giftgrantprovideaid,what is the <arg> in <trg>,evt136arg01giver,evt136arg02recipient,evt136arg03beneficiary,evt136arg04money,evt136arg05place
143
- transaction.transfermoney.payforservice,what is the <arg> in <trg>,evt137arg01giver,evt137arg02recipient,evt137arg03beneficiary,evt137arg04money,evt137arg05place
144
- transaction.transfermoney.purchase,what is the <arg> in <trg>,evt138arg01giver,evt138arg02recipient,evt138arg03beneficiary,evt138arg04money,evt138arg05place
145
- transaction.transferownership.unspecified,what is the <arg> in <trg>,evt139arg01giver,evt139arg02recipient,evt139arg03beneficiary,evt139arg04artifact,evt139arg05place
146
- transaction.transferownership.borrowlend,what is the <arg> in <trg>,evt140arg01giver,evt140arg02recipient,evt140arg03beneficiary,evt140arg04artifact,evt140arg05place
147
- transaction.transferownership.embargosanction,what is the <arg> in <trg>,evt141arg01preventer,evt141arg02giver,evt141arg03recipient,evt141arg04artifact,evt141arg05place
148
- transaction.transferownership.giftgrantprovideaid,what is the <arg> in <trg>,evt142arg01giver,evt142arg02recipient,evt142arg03beneficiary,evt142arg04artifact,evt142arg05place
149
- transaction.transferownership.purchase,what is the <arg> in <trg>,evt143arg01giver,evt143arg02recipient,evt143arg03beneficiary,evt143arg04artifact,evt143arg05place
150
- transaction.transaction.transfercontrol,what is the <arg> in <trg>,evt144arg01giver,evt144arg02recipient,evt144arg03beneficiary,evt144arg04territoryorfacility,evt144arg05place
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
git_token.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 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
head_templates_preprocessed_data/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6fc0897dedcf9a21f9c6ff714252dcd6a848e4232b25b53fa8abe01531861ec6
3
+ size 3066918
head_templates_preprocessed_data/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25889f02191e5795956b8b90296fb3321ae2791dccde73c5357b3b8222a55f25
3
+ size 25867551
head_templates_preprocessed_data/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cf4088666e0b8bcf0c0dfa7a73e37888e7b59b372d2aa1e0ce639968f527cce
3
+ size 3253644
head_templates_preprocessed_data1/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83d87f29c4a507a480909aa143eb08f2899190ca79f45802085bed2abe6d50ad
3
+ size 12594026
head_templates_preprocessed_data1/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94d2580d63a3bcc3860b2ba831f37cddbec554245911efeb74c0a5a2283181c6
3
+ size 106010729
head_templates_preprocessed_data1/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7645dbb2d4ea9a8b87312017c0b0c2b29c04b6a25ae49c44b76a47d495cd238
3
+ size 13401304
head_templates_preprocessed_data_new/temp/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ad788635d60421739fd18f4bd5d78b4c90480aee2cafbe874cd19e0db5ce74d
3
+ size 15027755
head_templates_preprocessed_data_new/temp/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:353fbe88531d1ed9d0643aa41143ec24eb49e4a837c456252c6e1a8926019fa2
3
+ size 9445758
head_templates_preprocessed_data_new/temp/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90eb683a2f263cd036d938a150a78a6f4b90d97d3138d65ea699cff70f0e6c45
3
+ size 15911790
head_templates_preprocessed_data_new/temp1/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b2bedfaca006752cfa871997d29fcc41101f6db44e55dd522893453a6204d63
3
+ size 15027727
head_templates_preprocessed_data_new/temp1/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb16a36aaf8b636f67ab18efbe5e4c1e1afbecc3ad38ee7412a27cb75386090b
3
+ size 126534242
head_templates_preprocessed_data_new/temp1/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:143c303d5c7048be41d40d021817af2ade7ccd2d91385bc895d099f00e7019ed
3
+ size 15911353
head_templates_preprocessed_data_new/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:025353048caa8160e84a9abf9f075e783681cde39b86db7600c6de7a30de8eb9
3
+ size 12555891
head_templates_preprocessed_data_new/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb6de08bf114d936e7b56c72b19959d2845ee49030dd0bac3200c00fe5e26693
3
+ size 105639380
head_templates_preprocessed_data_new/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4efc8da757337673393c6f9956e1d4096d6472aa95cb0b82b7034d9a0b101f2
3
+ size 13355352
head_templates_preprocessed_data_test/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83d87f29c4a507a480909aa143eb08f2899190ca79f45802085bed2abe6d50ad
3
+ size 12594026
head_templates_preprocessed_data_test/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94d2580d63a3bcc3860b2ba831f37cddbec554245911efeb74c0a5a2283181c6
3
+ size 106010729
head_templates_preprocessed_data_test/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7645dbb2d4ea9a8b87312017c0b0c2b29c04b6a25ae49c44b76a47d495cd238
3
+ size 13401304
head_what_preprocessed_data/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fbbdf09172f43a2baa638a802158509a3ee8408f745488bea0edfd330ee5883
3
+ size 12517258
head_what_preprocessed_data/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8efdc975af0cccee3658c564154129919e12d546ef0638439e10959930ed48a8
3
+ size 105370045
head_what_preprocessed_data/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62b955d1868f0e7cafa614129d48599f707cc332b648da7cd8942d875e0d1e33
3
+ size 13318850
span_preprocessed_data/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7c8c3a8c868525a8d22a8f93ee71eeaccc4561d10ccabb48c5a8819d8ce2f42
3
+ size 3040920
span_preprocessed_data/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d59722f2d8c512844a2995fdebd15b687581fde11b714ee49e4dc19922fd9f8f
3
+ size 25648444
span_preprocessed_data/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38da46ab63668fb37a8592573e0562e48245c6d81335c78d40dc957ea161ec79
3
+ size 3226018
span_templates_preprocessed_data1/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b6ba5486138269e29be526d6a42a5eab956851f2b06bc638dcbe6342c8278fd
3
+ size 12599344
span_templates_preprocessed_data1/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94d2580d63a3bcc3860b2ba831f37cddbec554245911efeb74c0a5a2283181c6
3
+ size 106010729
span_templates_preprocessed_data1/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7645dbb2d4ea9a8b87312017c0b0c2b29c04b6a25ae49c44b76a47d495cd238
3
+ size 13401304
span_what_preprocessed_data/test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ece6b9edc106e02298fb1105d7f3972f46b23b307503c3470b2d24e156bb930
3
+ size 12522576
span_what_preprocessed_data/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8efdc975af0cccee3658c564154129919e12d546ef0638439e10959930ed48a8
3
+ size 105370045
span_what_preprocessed_data/val.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62b955d1868f0e7cafa614129d48599f707cc332b648da7cd8942d875e0d1e33
3
+ size 13318850
src/genie/.data_module3.py.swp ADDED
Binary file (16.4 kB). View file
 
src/genie/convert_gen_to_output5.py ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import argparse
4
+ import re
5
+ from copy import deepcopy
6
+ from tqdm import tqdm
7
+
8
+ from utils import find_head, WhitespaceTokenizer, find_arg_span
9
+ import spacy
10
+ print("convert_gen_to_output5.py")
11
+ def extract_args_from_template(ex, template, ontology_dict,):
12
+ # extract argument text
13
+ # 这个函数的返回值是一个字典 因此需要 template列表和ex中的predicted列表同时进行遍历放入字典中
14
+ # 在这里定义两个列表 分别存放 定义存放模板的列表 TEMPLATE 和 相对应的生成 PREDICTED
15
+ # 传过来的参数中的template就是包含所有模板的列表 因此不需要再定义TEMPLATE 还是需要定义一个存放分词后的template
16
+ # 这里的template是相应事件类型下的模板包含多个
17
+ # 原来处理的方式是一个数据和一个综合性模板 现在模板是分开的 为什么要把template传过来 这不是脱裤子放屁的操作?
18
+ # 下面这段操作是因为上次模板的定义是相同因此只需要去列表中的第一个模板就行 这次需要用循环进行遍历
19
+ t = []
20
+ TEMPLATE = []
21
+ for i in template:
22
+ t = i.strip().split()
23
+ TEMPLATE.append(t)
24
+ t = []
25
+ # 到此为止 得到存放该ex即该数据类型下的所有模板的分词后的列表存储 下面获取对应的predicted同理
26
+ PREDICTED = []
27
+ p = []
28
+ for i in ex['predicted']:
29
+ p = i.strip().split()
30
+ PREDICTED.append(p)
31
+ p = []
32
+ # 这个字典变量定义了这个函数的返回值 应该是论元角色-论元短语的key-value映射
33
+ predicted_args = {}
34
+ evt_type = get_event_type(ex)[0]
35
+ # 不出意外的话 TEMPLATE和PREDICTED的长度应该是相等的
36
+ length = len(TEMPLATE)
37
+ for i in range(length):
38
+ template_words = TEMPLATE[i]
39
+ predicted_words = PREDICTED[i]
40
+ t_ptr = 0
41
+ p_ptr = 0
42
+ while t_ptr < len(template_words) and p_ptr < len(predicted_words):
43
+ if re.match(r'<(arg\d+)>', template_words[t_ptr]):
44
+ m = re.match(r'<(arg\d+)>', template_words[t_ptr])
45
+ # 这一步的操作是从模板中到 <arg1> 这样的词符 即arg_num 然后通过arg_num找到对应论元角色arg_name
46
+ arg_num = m.group(1)
47
+ arg_name = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_num]
48
+
49
+ if predicted_words[p_ptr] == '<arg>':
50
+ # missing argument
51
+ p_ptr +=1
52
+ t_ptr +=1
53
+ else:
54
+ arg_start = p_ptr
55
+ if t_ptr + 1 == len(template_words):
56
+ while p_ptr < len(predicted_words):
57
+ p_ptr += 1
58
+ else:
59
+ while (p_ptr < len(predicted_words)) and (predicted_words[p_ptr] != template_words[t_ptr+1]):
60
+ p_ptr += 1
61
+ arg_text = predicted_words[arg_start:p_ptr]
62
+ predicted_args[arg_name] = arg_text
63
+ t_ptr += 1
64
+ # aligned
65
+ else:
66
+ t_ptr += 1
67
+ p_ptr += 1
68
+
69
+ return predicted_args
70
+
71
+ def get_event_type(ex):
72
+ evt_type = []
73
+ for evt in ex['evt_triggers']:
74
+ for t in evt[2]:
75
+ evt_type.append( t[0])
76
+ return evt_type
77
+
78
+ def check_coref(ex, arg_span, gold_spans):
79
+ for clus in ex['corefs']:
80
+ if arg_span in clus:
81
+ matched_gold_spans = [span for span in gold_spans if span in clus]
82
+ if len(matched_gold_spans) > 0:
83
+ return matched_gold_spans[0]
84
+ return arg_span
85
+
86
+ if __name__ == '__main__':
87
+ parser = argparse.ArgumentParser()
88
+ parser.add_argument('--gen-file',type=str, default='checkpoints/gen-new-tokenization-pred/sample_predictions.jsonl')
89
+ parser.add_argument('--test-file', type=str,default='data/RAMS_1.0/data/test_head.jsonlines')
90
+ parser.add_argument('--output-file',type=str, default='test_output.jsonl')
91
+ parser.add_argument('--ontology-file',type=str, default='aida_ontology_new.csv')
92
+ parser.add_argument('--head-only',action='store_true',default=False)
93
+ parser.add_argument('--coref', action='store_true', default=False)
94
+ args = parser.parse_args()
95
+
96
+ # 加载词典
97
+ nlp = spacy.load('en_core_web_sm')
98
+ nlp.tokenizer = WhitespaceTokenizer(nlp.vocab)
99
+ # read ontology 读取事件本体 模板文件中的内容
100
+ ontology_dict = {}
101
+ with open('aida_ontology_fj-w-2.csv', 'r') as f:
102
+ for lidx, line in enumerate(f):
103
+ if lidx == 0: # header
104
+ continue
105
+ fields = line.strip().split(',')
106
+ if len(fields) < 2:
107
+ break
108
+ evt_type = fields[0]
109
+ if evt_type in ontology_dict.keys():
110
+ arguments = fields[2:]
111
+ ontology_dict[evt_type]['template'].append(fields[1])
112
+ for i, arg in enumerate(arguments):
113
+ if arg != '':
114
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
115
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
116
+ else:
117
+ ontology_dict[evt_type] = {}
118
+ arguments = fields[2:]
119
+ ontology_dict[evt_type]['template'] = []
120
+ ontology_dict[evt_type]['template'].append(fields[1])
121
+ for i, arg in enumerate(arguments):
122
+ if arg != '':
123
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
124
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
125
+ examples = {}
126
+ print(args.gen_file)
127
+ # data/RAMS_1.0/data/test_head_coref.jsonlines
128
+ key = []
129
+ with open(args.test_file, 'r') as f:
130
+ for line in f:
131
+ ex = json.loads(line.strip())
132
+ #if ex['gold_evt_links'] == []:
133
+ #key.append(ex['doc_key'])
134
+ #continue
135
+ ex['ref_evt_links'] = deepcopy(ex['gold_evt_links'])
136
+ ex['gold_evt_links'] = []
137
+ examples[ex['doc_key']] = ex
138
+
139
+ # checkpoints/gen-RAMS-pred/predictions.jsonl
140
+ flag = {}
141
+ with open(args.gen_file,'r') as f:
142
+ for line in f:
143
+ pred = json.loads(line.strip())
144
+ # print(pred)
145
+ # 因为最后生成 应该是 多个相同的事件类型在并列 这个操作好像把已经填入的predicte覆盖掉了
146
+ # 在这里的循环中 应该继续向下扫描 采取和ontology中相同的处理方式 用列表的方式存储将pred中的内容存放到examples中的数据中
147
+ # pred 是对预测文件中的预测结果句用空格进行分隔单词后的结果
148
+ # pred中的内容主要包括 doc_key predicted gold
149
+ # 如果扫描到的预测json数据事件类型在examples中存在 那么就将predicted存入列表
150
+ # if pred['doc_key'] not in key:
151
+ if pred['doc_key'] in flag.keys():
152
+ #print(examples[pred['doc_key']]['predicted'])
153
+ examples[pred['doc_key']]['predicted'].append(pred['predicted'])
154
+ examples[pred['doc_key']]['gold'].append(pred['gold'])
155
+ # 如果没有 说明这是新的事件类型
156
+ else:
157
+ flag[pred['doc_key']] = True
158
+ examples[pred['doc_key']]['predicted'] = []
159
+ examples[pred['doc_key']]['gold'] = []
160
+ # 然后将此条数据存入
161
+ examples[pred['doc_key']]['predicted'].append(pred['predicted'])
162
+ examples[pred['doc_key']]['gold'].append(pred['gold'])
163
+
164
+ # checkpoints/gen-RAMS-pred/out_put.jsonl
165
+ writer = open(args.output_file, 'w')
166
+ for ex in tqdm(examples.values()):
167
+ if 'predicted' not in ex:# this is used for testing
168
+ continue
169
+ # get template 获取事件类型
170
+ evt_type = get_event_type(ex)[0]
171
+ context_words = [w for sent in ex['sentences'] for w in sent]
172
+ # 这里的template是ontology_dict中 template 包含一个事件类型下的所有事件模板
173
+ template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
174
+ # extract argument text
175
+ # 这里应该是提取预测文件中预测到的论元短语 ex是一条json数据 template是这条json数据对应下的模板 on是论元角色和<arg1>的映射
176
+ # 这里ex中的predicted和gold已经包括了该事件类型下的所有论元 用列表的形式进行存储 且顺序是一一对应的
177
+ # 这里返回的predicted_args是一个字典:
178
+ predicted_args = extract_args_from_template(ex, template, ontology_dict)
179
+ # get trigger
180
+ # extract argument span 找出触发词在文段中的索引
181
+ str_p = ''
182
+ str_g = ''
183
+ for i in range(len(ex['predicted'])):
184
+ str_p += ex['predicted'][i]
185
+ str_g += ex['gold'][i]
186
+
187
+ ex['predicted'] = str_p
188
+ ex['gold'] = str_g
189
+ trigger_start = ex['evt_triggers'][0][0]
190
+ trigger_end = ex['evt_triggers'][0][1]
191
+ # 上面返回的predicted_args是一个字典 暂时认为是论元角色和具体论元短语的映射
192
+ # 还没有发现doc的作用
193
+ doc = None
194
+ # 通过test_rams.sh文件的设置 可以发现args.head_only的值为true
195
+ # print('aa', args.head_only, args.coref)
196
+ if args.head_only:
197
+ # 从原始文本中取出标记
198
+ doc = nlp(' '.join(context_words))
199
+ # 其中arg_name是论元角色类型
200
+ for argname in predicted_args:
201
+ # 通过find_arg_span函数找出
202
+ arg_span = find_arg_span(predicted_args[argname], context_words,
203
+ trigger_start, trigger_end, head_only=args.head_only, doc=doc)
204
+ #print(arg_span)
205
+ if arg_span:# if None means hullucination
206
+
207
+ if args.head_only and args.coref:
208
+ # consider coreferential mentions as matching
209
+ assert('corefs' in ex)
210
+ print('aaa')
211
+ gold_spans = [a[1] for a in ex['ref_evt_links'] if a[2]==argname]
212
+ arg_span = check_coref(ex, list(arg_span), gold_spans)
213
+
214
+ ex['gold_evt_links'].append([[trigger_start, trigger_end], list(arg_span), argname])
215
+
216
+ writer.write(json.dumps(ex)+'\n')
217
+
218
+ writer.close()
219
+
220
+
221
+
src/genie/data_module4.py ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import jsonlines
4
+ import re
5
+ import random
6
+ from collections import defaultdict
7
+ import argparse
8
+
9
+ import transformers
10
+ from transformers import BartTokenizer
11
+ import torch
12
+ from torch.utils.data import DataLoader
13
+ import pytorch_lightning as pl
14
+
15
+ from .data import IEDataset, my_collate
16
+
17
+ MAX_LENGTH = 424
18
+ MAX_TGT_LENGTH = 72
19
+ DOC_STRIDE = 256
20
+
21
+ print("data_module4.py")
22
+
23
+ class RAMSDataModule(pl.LightningDataModule):
24
+ def __init__(self, args):
25
+ super().__init__()
26
+ self.hparams = args
27
+ self.tokenizer = BartTokenizer.from_pretrained('facebook/bart-large')
28
+ self.tokenizer.add_tokens([' <arg>', ' <tgr>'])
29
+
30
+ def get_event_type(self, ex):
31
+ evt_type = []
32
+ for evt in ex['evt_triggers']:
33
+ for t in evt[2]:
34
+ evt_type.append(t[0])
35
+ return evt_type
36
+
37
+ def create_gold_gen(self, ex, ontology_dict, mark_trigger=True):
38
+ # 设置三个总列表、存放输入模板、输出模板
39
+ INPUT = []
40
+ OUTPUT = []
41
+ CONTEXT = []
42
+ evt_type = self.get_event_type(ex)[0]
43
+
44
+ context_words = [w for sent in ex['sentences'] for w in sent]
45
+ input_template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
46
+ i = len(input_template)
47
+ input_list = []
48
+ for x in range(i):
49
+ str = re.sub(r'<arg\d>', '<arg>', input_template[x])
50
+ input_list.append(str)
51
+ # 其中input_list种存放的是 原始数据中<arg1> 全部替换为 <arg> 之后的模板 下一步应该进行分词
52
+ temp = []
53
+ for x in range(i):
54
+ space_tokenized_template = input_list[x].split(' ')
55
+ temp.append(space_tokenized_template)
56
+ space_tokenized_template = []
57
+ # 其中temp中存放的都是分词后的模板 下一步对temp中的所有元素进行tokenize
58
+ tokenized_input_template = []
59
+ for x in range(len(temp)):
60
+ for w in temp[x]:
61
+ tokenized_input_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
62
+ INPUT.append(tokenized_input_template)
63
+ tokenized_input_template = []
64
+ template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
65
+ for lidx, triple in enumerate(ex['gold_evt_links']):
66
+ # 触发词 论元 论元
67
+ # 例子: "gold_evt_links":
68
+ # [[[40, 40], [33, 33], "evt089arg01victim"],
69
+ # [[40, 40], [28, 28], "evt089arg02place"]]
70
+ trigger_span, argument_span, arg_name = triple
71
+ # 第几个论元
72
+ arg_num = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_name]
73
+ # 具体论元内容 短语
74
+ arg_text = ' '.join(context_words[argument_span[0]:argument_span[1] + 1])
75
+ # 通过正则表达式的方式将模板中的每个<arg> 替换为具体的论元内容
76
+ for index in range(len(template)):
77
+ if arg_num in template[index]:
78
+ break
79
+ else:
80
+ continue
81
+
82
+
83
+ template[index] = re.sub('<{}>'.format(arg_num), arg_text, template[index])
84
+
85
+
86
+ trigger = ex['evt_triggers'][0]
87
+ if mark_trigger:
88
+ trigger_span_start = trigger[0]
89
+ trigger_span_end = trigger[1] + 2 # one for inclusion, one for extra start marker
90
+ # 触发词之前的单词
91
+ prefix = self.tokenizer.tokenize(' '.join(context_words[:trigger[0]]), add_prefix_space=True)
92
+ # 触发词短语
93
+ tgt = self.tokenizer.tokenize(' '.join(context_words[trigger[0]: trigger[1] + 1]),
94
+ add_prefix_space=True)
95
+ # 触发词之后的单词
96
+ suffix = self.tokenizer.tokenize(' '.join(context_words[trigger[1] + 1:]), add_prefix_space=True)
97
+ context = prefix + [' <tgr>', ] + tgt + [' <tgr>', ] + suffix
98
+ else:
99
+ context = self.tokenizer.tokenize(' '.join(context_words), add_prefix_space=True)
100
+ # 将context放入CONTEXT中
101
+ for w in range(i):
102
+ CONTEXT.append(context)
103
+ output_template = []
104
+ # 此时的template中已经全部替换为论元短语 这部是将<arg1> 替换为<arg>
105
+ for i in range(len(template)):
106
+ output_template.append(re.sub(r'<arg\d>', '<arg>', template[i]))
107
+ spaceout_tokenized_template = []
108
+ for i in range(len(output_template)):
109
+ spaceout_tokenized_template.append(output_template[i].split(' '))
110
+ tokenized_out_template = []
111
+ for i in range(len(spaceout_tokenized_template)):
112
+ for w in spaceout_tokenized_template[i]:
113
+ tokenized_out_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
114
+ OUTPUT.append(tokenized_out_template)
115
+ tokenized_out_template = []
116
+
117
+ return INPUT, OUTPUT, CONTEXT
118
+
119
+ def load_ontology(self):
120
+ ontology_dict = {}
121
+ with open('aida_ontology_fj-5.csv', 'r') as f:
122
+ for lidx, line in enumerate(f):
123
+ if lidx == 0: # header
124
+ continue
125
+ fields = line.strip().split(',')
126
+ if len(fields) < 2:
127
+ break
128
+ evt_type = fields[0]
129
+ if evt_type in ontology_dict.keys():
130
+ args = fields[2:]
131
+ ontology_dict[evt_type]['template'].append(fields[1])
132
+ for i, arg in enumerate(args):
133
+ if arg != '':
134
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
135
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
136
+ else:
137
+ ontology_dict[evt_type] = {}
138
+ args = fields[2:]
139
+ ontology_dict[evt_type]['template'] = []
140
+ ontology_dict[evt_type]['template'].append(fields[1])
141
+ for i, arg in enumerate(args):
142
+ if arg != '':
143
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
144
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
145
+
146
+ return ontology_dict
147
+
148
+
149
+ def prepare_data(self):
150
+ if not os.path.exists('span_templates_preprocessed_data1'):
151
+ os.makedirs('span_templates_preprocessed_data1')
152
+
153
+ ontology_dict = self.load_ontology()
154
+
155
+ # print(ontology_dict['contact.prevarication.broadcast'])
156
+
157
+ for split, f in [('train', self.hparams.train_file), ('val', self.hparams.val_file),
158
+ ('test', self.hparams.test_file)]:
159
+ with open(f, 'r') as reader, open('span_templates_preprocessed_data1/{}.jsonl'.format(split), 'w') as writer:
160
+ for lidx, line in enumerate(reader):
161
+ ex = json.loads(line.strip())
162
+ input_template, output_template, context = self.create_gold_gen(ex, ontology_dict,
163
+ self.hparams.mark_trigger)
164
+ ontology_dict = self.load_ontology()
165
+ length = len(input_template)
166
+ # print(input_template)
167
+ # print(output_template)
168
+ # print(context)
169
+ for i in range(length):
170
+ input_tokens = self.tokenizer.encode_plus(input_template[i], context[i],
171
+ add_special_tokens=True,
172
+ add_prefix_space=True,
173
+ max_length=MAX_LENGTH,
174
+ truncation='only_second',
175
+ padding='max_length')
176
+ # target_tokens
177
+ tgt_tokens = self.tokenizer.encode_plus(output_template[i],
178
+ add_special_tokens=True,
179
+ add_prefix_space=True,
180
+ max_length=MAX_TGT_LENGTH,
181
+ truncation=True,
182
+ padding='max_length')
183
+ # input_ids 单词在词典中的编码
184
+ # tgt_tokens 指定对哪些词进行self_attention操作
185
+ processed_ex = {
186
+ # 'idx': lidx,
187
+ 'doc_key': ex['doc_key'],
188
+ 'input_token_ids': input_tokens['input_ids'],
189
+ 'input_attn_mask': input_tokens['attention_mask'],
190
+ 'tgt_token_ids': tgt_tokens['input_ids'],
191
+ 'tgt_attn_mask': tgt_tokens['attention_mask'],
192
+ }
193
+ #print(processed_ex)
194
+ writer.write(json.dumps(processed_ex) + "\n")
195
+
196
+ def train_dataloader(self):
197
+ dataset = IEDataset('span_templates_preprocessed_data1/train.jsonl')
198
+
199
+ dataloader = DataLoader(dataset,
200
+ pin_memory=True, num_workers=2,
201
+ collate_fn=my_collate,
202
+ batch_size=self.hparams.train_batch_size,
203
+ shuffle=True)
204
+ return dataloader
205
+
206
+ def val_dataloader(self):
207
+ dataset = IEDataset('span_templates_preprocessed_data1/val.jsonl')
208
+
209
+ dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
210
+ collate_fn=my_collate,
211
+ batch_size=self.hparams.eval_batch_size, shuffle=False)
212
+ return dataloader
213
+
214
+ def test_dataloader(self):
215
+ dataset = IEDataset('span_templates_preprocessed_data1/test.jsonl')
216
+
217
+ dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
218
+ collate_fn=my_collate,
219
+ batch_size=self.hparams.eval_batch_size, shuffle=False)
220
+
221
+ return dataloader
222
+
223
+
224
+ if __name__ == '__main__':
225
+ parser = argparse.ArgumentParser()
226
+ parser.add_argument('--train-file', type=str, default='data/RAMS_1.0/data/train.jsonlines')
227
+ parser.add_argument('--val-file', type=str, default='data/RAMS_1.0/data/dev.jsonlines')
228
+ parser.add_argument('--test-file', type=str, default='data/RAMS_1.0/data/test.jsonlines')
229
+ parser.add_argument('--train_batch_size', type=int, default=2)
230
+ parser.add_argument('--eval_batch_size', type=int, default=4)
231
+ parser.add_argument('--mark-trigger', action='store_true', default=True)
232
+ args = parser.parse_args()
233
+
234
+ print("data_module1.pyaaaaaaaaaaaaaaa")
235
+ dm = RAMSDataModule(args=args)
236
+ dm.prepare_data()
237
+
238
+ # training dataloader
239
+ dataloader = dm.train_dataloader()
240
+
241
+ for idx, batch in enumerate(dataloader):
242
+ print(batch)
243
+ break
244
+
245
+ # val dataloader
src/genie/data_module_w.py ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import jsonlines
4
+ import re
5
+ import random
6
+ from collections import defaultdict
7
+ import argparse
8
+
9
+ import transformers
10
+ from transformers import BartTokenizer
11
+ import torch
12
+ from torch.utils.data import DataLoader
13
+ import pytorch_lightning as pl
14
+
15
+ from .data import IEDataset, my_collate
16
+
17
+ MAX_LENGTH = 424
18
+ MAX_TGT_LENGTH = 72
19
+ DOC_STRIDE = 256
20
+
21
+ print("data_module-w.py")
22
+
23
+ class RAMSDataModule(pl.LightningDataModule):
24
+ def __init__(self, args):
25
+ super().__init__()
26
+ self.hparams = args
27
+ self.tokenizer = BartTokenizer.from_pretrained('facebook/bart-large')
28
+ self.tokenizer.add_tokens([' <arg>', ' <tgr>'])
29
+
30
+ def get_event_type(self, ex):
31
+ evt_type = []
32
+ for evt in ex['evt_triggers']:
33
+ for t in evt[2]:
34
+ evt_type.append(t[0])
35
+ return evt_type
36
+
37
+ # 此函数找出对应的trigger的索引
38
+ def get_trigger_index(self, ex):
39
+ return ex['evt_triggers'][0][0]
40
+
41
+ def create_gold_gen(self, ex, ontology_dict, mark_trigger=True):
42
+ # 设置三个总列表、存放输入模板、输出模板
43
+ INPUT = []
44
+ OUTPUT = []
45
+ CONTEXT = []
46
+ evt_type = self.get_event_type(ex)[0]
47
+
48
+ context_words = [w for sent in ex['sentences'] for w in sent]
49
+ input_template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
50
+ trigger_index = self.get_trigger_index(ex)
51
+ # 找到对应的trigger
52
+ trigger = context_words[trigger_index]
53
+ i = len(input_template)
54
+ input_list = []
55
+ for x in range(i):
56
+ str = re.sub('<trg>', trigger, input_template[x])
57
+ str = re.sub('<trg>', trigger, str)
58
+ input_list.append(str)
59
+ # 其中input_list种存放的是 原始数据中<arg1> 全部替换为 <arg> 之后的模板 下一步应该进行分词
60
+ temp = []
61
+ for x in range(i):
62
+ space_tokenized_template = input_list[x].split(' ')
63
+ temp.append(space_tokenized_template)
64
+ space_tokenized_template = []
65
+ # 其中temp中存放的都是分词后的模板 下一步对temp中的所有元素进行tokenize
66
+ tokenized_input_template = []
67
+ for x in range(len(temp)):
68
+ for w in temp[x]:
69
+ tokenized_input_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
70
+ INPUT.append(tokenized_input_template)
71
+ tokenized_input_template = []
72
+ template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
73
+ for y in range(len(template)):
74
+ template[y] = re.sub('<trg>', trigger, template[y])
75
+ for lidx, triple in enumerate(ex['gold_evt_links']):
76
+ # 触发词 论元 论元
77
+ # 例子: "gold_evt_links":
78
+ # [[[40, 40], [33, 33], "evt089arg01victim"],
79
+ # [[40, 40], [28, 28], "evt089arg02place"]]
80
+ trigger_span, argument_span, arg_name = triple
81
+ # 第几个论元
82
+ arg_num = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_name]
83
+ # 具体论元内容 短语
84
+ arg_text = ' '.join(context_words[argument_span[0]:argument_span[1] + 1])
85
+ # 通过正则表达式的方式将模板中的每个<arg> 替换为具体的论元内容
86
+ for index in range(len(template)):
87
+ if arg_num in template[index]:
88
+ break
89
+ else:
90
+ continue
91
+
92
+
93
+ template[index] = re.sub('<{}>'.format(arg_num), arg_text, template[index])
94
+
95
+
96
+ trigger = ex['evt_triggers'][0]
97
+ if mark_trigger:
98
+ trigger_span_start = trigger[0]
99
+ trigger_span_end = trigger[1] + 2 # one for inclusion, one for extra start marker
100
+ # 触发词之前的单词
101
+ prefix = self.tokenizer.tokenize(' '.join(context_words[:trigger[0]]), add_prefix_space=True)
102
+ # 触发词短语
103
+ tgt = self.tokenizer.tokenize(' '.join(context_words[trigger[0]: trigger[1] + 1]),
104
+ add_prefix_space=True)
105
+ # 触发词之后的单词
106
+ suffix = self.tokenizer.tokenize(' '.join(context_words[trigger[1] + 1:]), add_prefix_space=True)
107
+ context = prefix + [' <tgr>', ] + tgt + [' <tgr>', ] + suffix
108
+ else:
109
+ context = self.tokenizer.tokenize(' '.join(context_words), add_prefix_space=True)
110
+ # 将context放入CONTEXT中
111
+ for w in range(i):
112
+ CONTEXT.append(context)
113
+ output_template = []
114
+ # 此时的template中已经全部替换为论元短语 这部是将<arg1> 替换为<arg>
115
+ for i in range(len(template)):
116
+ output_template.append(re.sub(r'<arg\d>', '<arg>', template[i]))
117
+ spaceout_tokenized_template = []
118
+ for i in range(len(output_template)):
119
+ spaceout_tokenized_template.append(output_template[i].split(' '))
120
+ tokenized_out_template = []
121
+ for i in range(len(spaceout_tokenized_template)):
122
+ for w in spaceout_tokenized_template[i]:
123
+ tokenized_out_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
124
+ OUTPUT.append(tokenized_out_template)
125
+ tokenized_out_template = []
126
+
127
+ return INPUT, OUTPUT, CONTEXT
128
+
129
+ def load_ontology(self):
130
+ ontology_dict = {}
131
+ with open('aida_ontology_fj-w-2.csv', 'r') as f:
132
+ for lidx, line in enumerate(f):
133
+ if lidx == 0: # header
134
+ continue
135
+ fields = line.strip().split(',')
136
+ if len(fields) < 2:
137
+ break
138
+ evt_type = fields[0]
139
+ if evt_type in ontology_dict.keys():
140
+ args = fields[2:]
141
+ ontology_dict[evt_type]['template'].append(fields[1])
142
+ for i, arg in enumerate(args):
143
+ if arg != '':
144
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
145
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
146
+ else:
147
+ ontology_dict[evt_type] = {}
148
+ args = fields[2:]
149
+ ontology_dict[evt_type]['template'] = []
150
+ ontology_dict[evt_type]['template'].append(fields[1])
151
+ for i, arg in enumerate(args):
152
+ if arg != '':
153
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
154
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
155
+
156
+ return ontology_dict
157
+
158
+
159
+ def prepare_data(self):
160
+ if not os.path.exists('head_what_preprocessed_data'):
161
+ os.makedirs('head_what_preprocessed_data')
162
+
163
+ ontology_dict = self.load_ontology()
164
+
165
+ # print(ontology_dict['contact.prevarication.broadcast'])
166
+
167
+ for split, f in [('train', self.hparams.train_file), ('val', self.hparams.val_file),
168
+ ('test', self.hparams.test_file)]:
169
+ with open(f, 'r') as reader, open('head_what_preprocessed_data/{}.jsonl'.format(split), 'w') as writer:
170
+ for lidx, line in enumerate(reader):
171
+ ex = json.loads(line.strip())
172
+ input_template, output_template, context = self.create_gold_gen(ex, ontology_dict,
173
+ self.hparams.mark_trigger)
174
+ ontology_dict = self.load_ontology()
175
+ length = len(input_template)
176
+ # print(input_template)
177
+ # print(output_template)
178
+ # print(context)
179
+ for i in range(length):
180
+ input_tokens = self.tokenizer.encode_plus(input_template[i], context[i],
181
+ add_special_tokens=True,
182
+ add_prefix_space=True,
183
+ max_length=MAX_LENGTH,
184
+ truncation='only_second',
185
+ padding='max_length')
186
+ # target_tokens
187
+ tgt_tokens = self.tokenizer.encode_plus(output_template[i],
188
+ add_special_tokens=True,
189
+ add_prefix_space=True,
190
+ max_length=MAX_TGT_LENGTH,
191
+ truncation=True,
192
+ padding='max_length')
193
+ # input_ids 单词在词典中的编码
194
+ # tgt_tokens 指定对哪些词进行self_attention操作
195
+ processed_ex = {
196
+ # 'idx': lidx,
197
+ 'doc_key': ex['doc_key'],
198
+ 'input_token_ids': input_tokens['input_ids'],
199
+ 'input_attn_mask': input_tokens['attention_mask'],
200
+ 'tgt_token_ids': tgt_tokens['input_ids'],
201
+ 'tgt_attn_mask': tgt_tokens['attention_mask'],
202
+ }
203
+ #print(processed_ex)
204
+ writer.write(json.dumps(processed_ex) + "\n")
205
+
206
+ def train_dataloader(self):
207
+ dataset = IEDataset('head_what_preprocessed_data/train.jsonl')
208
+
209
+ dataloader = DataLoader(dataset,
210
+ pin_memory=True, num_workers=2,
211
+ collate_fn=my_collate,
212
+ batch_size=self.hparams.train_batch_size,
213
+ shuffle=True)
214
+ return dataloader
215
+
216
+ def val_dataloader(self):
217
+ dataset = IEDataset('head_what_preprocessed_data/val.jsonl')
218
+
219
+ dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
220
+ collate_fn=my_collate,
221
+ batch_size=self.hparams.eval_batch_size, shuffle=False)
222
+ return dataloader
223
+
224
+ def test_dataloader(self):
225
+ dataset = IEDataset('head_what_preprocessed_data/test.jsonl')
226
+
227
+ dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
228
+ collate_fn=my_collate,
229
+ batch_size=self.hparams.eval_batch_size, shuffle=False)
230
+
231
+ return dataloader
232
+
233
+
234
+ if __name__ == '__main__':
235
+ parser = argparse.ArgumentParser()
236
+ parser.add_argument('--train-file', type=str, default='data/RAMS_1.0/data/train.jsonlines')
237
+ parser.add_argument('--val-file', type=str, default='data/RAMS_1.0/data/dev.jsonlines')
238
+ parser.add_argument('--test-file', type=str, default='data/RAMS_1.0/data/test_head.jsonlines')
239
+ parser.add_argument('--train_batch_size', type=int, default=2)
240
+ parser.add_argument('--eval_batch_size', type=int, default=4)
241
+ parser.add_argument('--mark-trigger', action='store_true', default=True)
242
+ args = parser.parse_args()
243
+
244
+ print("data_module1.pyaaaaaaaaaaaaaaa")
245
+ dm = RAMSDataModule(args=args)
246
+ dm.prepare_data()
247
+
248
+ # training dataloader
249
+ dataloader = dm.train_dataloader()
250
+
251
+ for idx, batch in enumerate(dataloader):
252
+ print(batch)
253
+ break
254
+
255
+ # val dataloader
src/genie/question/convert_gen_to_output2.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import argparse
4
+ import re
5
+ from copy import deepcopy
6
+ from tqdm import tqdm
7
+
8
+ from utils import find_head, WhitespaceTokenizer, find_arg_span
9
+ import spacy
10
+ print("convert_gen_to_output2.py")
11
+ def extract_args_from_template(ex, template, ontology_dict,):
12
+ # extract argument text
13
+ template_words = template[0].strip().split()
14
+ predicted_words = ex['predicted'].strip().split()
15
+ predicted_args = {}
16
+ t_ptr= 0
17
+ p_ptr= 0
18
+ evt_type = get_event_type(ex)[0]
19
+
20
+ while t_ptr < len(template_words) and p_ptr < len(predicted_words):
21
+ if re.match(r'<(arg\d+)>', template_words[t_ptr]):
22
+ m = re.match(r'<(arg\d+)>', template_words[t_ptr])
23
+ arg_num = m.group(1)
24
+ arg_name = ontology_dict[evt_type.replace('n/a','unspecified')][arg_num]
25
+
26
+ if predicted_words[p_ptr] == '<arg>':
27
+ # missing argument
28
+ p_ptr +=1
29
+ t_ptr +=1
30
+ else:
31
+ arg_start = p_ptr
32
+ while (p_ptr < len(predicted_words)) and (predicted_words[p_ptr] != template_words[t_ptr+1]):
33
+ p_ptr+=1
34
+ arg_text = predicted_words[arg_start:p_ptr]
35
+ predicted_args[arg_name] = arg_text
36
+ t_ptr+=1
37
+ # aligned
38
+ else:
39
+ t_ptr+=1
40
+ p_ptr+=1
41
+
42
+ return predicted_args
43
+
44
+
45
+
46
+
47
+
48
+
49
+ def get_event_type(ex):
50
+ evt_type = []
51
+ for evt in ex['evt_triggers']:
52
+ for t in evt[2]:
53
+ evt_type.append( t[0])
54
+ return evt_type
55
+
56
+ def check_coref(ex, arg_span, gold_spans):
57
+ for clus in ex['corefs']:
58
+ if arg_span in clus:
59
+ matched_gold_spans = [span for span in gold_spans if span in clus]
60
+ if len(matched_gold_spans) > 0:
61
+ return matched_gold_spans[0]
62
+ return arg_span
63
+
64
+
65
+ if __name__ == '__main__':
66
+ parser = argparse.ArgumentParser()
67
+ parser.add_argument('--gen-file',type=str, default='checkpoints/gen-new-tokenization-pred/sample_predictions.jsonl')
68
+ parser.add_argument('--test-file', type=str,default='data/RAMS_1.0/data/test_head.jsonlines')
69
+ parser.add_argument('--output-file',type=str, default='test_output.jsonl')
70
+ parser.add_argument('--ontology-file',type=str, default='aida_ontology_new.csv')
71
+ parser.add_argument('--head-only',action='store_true',default=False)
72
+ parser.add_argument('--coref', action='store_true', default=False)
73
+ args = parser.parse_args()
74
+
75
+ nlp = spacy.load('en_core_web_sm')
76
+ nlp.tokenizer = WhitespaceTokenizer(nlp.vocab)
77
+ # read ontology 读取事件本体 模板文件中的内容
78
+ ontology_dict ={}
79
+ with open('aida_ontology_new.csv','r') as f:
80
+ for lidx, line in enumerate(f):
81
+ # 跳过第一行表头字段
82
+ if lidx == 0:# header
83
+ continue
84
+ fields = line.strip().split(',')
85
+ # 说明该事件类型下不存在待抽取的论元
86
+ if len(fields) < 2:
87
+ break
88
+ # 事件类型是第一个
89
+ evt_type = fields[0]
90
+ # 从第三个元素往后都是待抽取论语及其论元角色
91
+ arguments = fields[2:]
92
+ # 获取该事件类型下带带抽取的论元数量
93
+ args_len = 0
94
+ for i, arg in enumerate(arguments):
95
+ if arg != '':
96
+ args_len = args_len + 1
97
+ # 将事件本体字典中添加事件类型的key,该key下对应的value为模板
98
+ # 利用args_len将template中的子模板数量进行循环增加, 将后续的子模板通过字符串拼接的方式进行增加
99
+ # 最终的模板样式变为 what is the <arg1> in <trg> what is the <arg2> in <trg>
100
+ # 先利用一个临时的字符串变量来存储模板 ----------> temp_template
101
+ temp_template = []
102
+ for i in range(len(arguments)):
103
+ temp_template.append(" what is the <arg{}> in <trg>".format(i + 1))
104
+ print(temp_template)
105
+ # 在事件本体字典中建立key-value 以事件类型为关键字
106
+ ontology_dict[evt_type] = {
107
+ 'template': temp_template
108
+ }
109
+
110
+ for i, arg in enumerate(arguments):
111
+ if arg !='':
112
+ ontology_dict[evt_type]['arg{}'.format(i+1)] = arg
113
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i+1)
114
+
115
+
116
+ examples = {}
117
+ print(args.gen_file)
118
+ # data/RAMS_1.0/data/test_head_coref.jsonlines
119
+ with open(args.test_file, 'r') as f:
120
+ for line in f:
121
+ ex = json.loads(line.strip())
122
+ ex['ref_evt_links'] = deepcopy(ex['gold_evt_links'])
123
+ ex['gold_evt_links'] = []
124
+ examples[ex['doc_key']] =ex
125
+
126
+ # checkpoints/gen-RAMS-pred/predictions.jsonl
127
+ with open(args.gen_file,'r') as f:
128
+ for line in f:
129
+ pred = json.loads(line.strip())
130
+ # print(pred)
131
+ examples[pred['doc_key']]['predicted'] = pred['predicted']
132
+ examples[pred['doc_key']]['gold'] = pred['gold']
133
+
134
+ # checkpoints/gen-RAMS-pred/out_put.jsonl
135
+ writer = open(args.output_file, 'w')
136
+ for ex in tqdm(examples.values()):
137
+ if 'predicted' not in ex:# this is used for testing
138
+ continue
139
+ # get template
140
+ evt_type = get_event_type(ex)[0]
141
+ context_words = [w for sent in ex['sentences'] for w in sent ]
142
+ template = ontology_dict[evt_type.replace('n/a','unspecified')]['template']
143
+ # extract argument text
144
+
145
+ predicted_args = extract_args_from_template(ex,template, ontology_dict)
146
+ # get trigger
147
+ # extract argument span
148
+ trigger_start = ex['evt_triggers'][0][0]
149
+ trigger_end = ex['evt_triggers'][0][1]
150
+ doc = None
151
+ if args.head_only:
152
+ doc = nlp(' '.join(context_words))
153
+
154
+ for argname in predicted_args:
155
+ arg_span = find_arg_span(predicted_args[argname], context_words,
156
+ trigger_start, trigger_end, head_only=args.head_only, doc=doc)
157
+ if arg_span:# if None means hullucination
158
+
159
+ if args.head_only and args.coref:
160
+ # consider coreferential mentions as matching
161
+ assert('corefs' in ex)
162
+ gold_spans = [a[1] for a in ex['ref_evt_links'] if a[2]==argname]
163
+ arg_span = check_coref(ex, list(arg_span), gold_spans)
164
+
165
+ ex['gold_evt_links'].append([[trigger_start, trigger_end], list(arg_span), argname])
166
+
167
+ writer.write(json.dumps(ex)+'\n')
168
+
169
+ writer.close()
170
+
171
+
172
+
src/genie/question/convert_gen_to_output4.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import argparse
4
+ import re
5
+ from copy import deepcopy
6
+ from tqdm import tqdm
7
+
8
+ from utils import find_head, WhitespaceTokenizer, find_arg_span
9
+ import spacy
10
+ print("convert_gen_to_output2.py")
11
+ def extract_args_from_template(ex, template, ontology_dict,):
12
+ # extract argument text
13
+ template_words = template[0].strip().split()
14
+ predicted_words = ex['predicted'].strip().split()
15
+ predicted_args = {}
16
+ t_ptr= 0
17
+ p_ptr= 0
18
+ evt_type = get_event_type(ex)[0]
19
+
20
+ while t_ptr < len(template_words) and p_ptr < len(predicted_words):
21
+ if re.match(r'<(arg\d+)>', template_words[t_ptr]):
22
+ m = re.match(r'<(arg\d+)>', template_words[t_ptr])
23
+ arg_num = m.group(1)
24
+ arg_name = ontology_dict[evt_type.replace('n/a','unspecified')][arg_num]
25
+
26
+ if predicted_words[p_ptr] == '<arg>':
27
+ # missing argument
28
+ p_ptr +=1
29
+ t_ptr +=1
30
+ else:
31
+ arg_start = p_ptr
32
+ while (p_ptr < len(predicted_words)) and (predicted_words[p_ptr] != template_words[t_ptr+1]):
33
+ p_ptr+=1
34
+ arg_text = predicted_words[arg_start:p_ptr]
35
+ predicted_args[arg_name] = arg_text
36
+ t_ptr+=1
37
+ # aligned
38
+ else:
39
+ t_ptr+=1
40
+ p_ptr+=1
41
+
42
+ return predicted_args
43
+
44
+
45
+
46
+
47
+
48
+
49
+ def get_event_type(ex):
50
+ evt_type = []
51
+ for evt in ex['evt_triggers']:
52
+ for t in evt[2]:
53
+ evt_type.append( t[0])
54
+ return evt_type
55
+
56
+ def check_coref(ex, arg_span, gold_spans):
57
+ for clus in ex['corefs']:
58
+ if arg_span in clus:
59
+ matched_gold_spans = [span for span in gold_spans if span in clus]
60
+ if len(matched_gold_spans) > 0:
61
+ return matched_gold_spans[0]
62
+ return arg_span
63
+
64
+
65
+ if __name__ == '__main__':
66
+ parser = argparse.ArgumentParser()
67
+ parser.add_argument('--gen-file',type=str, default='checkpoints/gen-new-tokenization-pred/sample_predictions.jsonl')
68
+ parser.add_argument('--test-file', type=str,default='data/RAMS_1.0/data/test_head.jsonlines')
69
+ parser.add_argument('--output-file',type=str, default='test_output.jsonl')
70
+ parser.add_argument('--ontology-file',type=str, default='aida_ontology_new.csv')
71
+ parser.add_argument('--head-only',action='store_true',default=False)
72
+ parser.add_argument('--coref', action='store_true', default=False)
73
+ args = parser.parse_args()
74
+
75
+ nlp = spacy.load('en_core_web_sm')
76
+ nlp.tokenizer = WhitespaceTokenizer(nlp.vocab)
77
+ # read ontology 读取事件本体 模板文件中的内容
78
+ ontology_dict ={}
79
+ with open('aida_ontology_new.csv','r') as f:
80
+ for lidx, line in enumerate(f):
81
+ if lidx == 0: # header
82
+ continue
83
+ fields = line.strip().split(',')
84
+ if len(fields) < 2:
85
+ break
86
+ # 获取事件类型
87
+ evt_type = fields[0]
88
+ # 如果该事件类型已经存在过
89
+ if evt_type in ontology_dict.keys():
90
+ # 得到该事件类型下的所有论元类型
91
+ arguments = fields[2:]
92
+ # 将该事件类型对应的模板中的论元模板 填充到onto_logy字典中
93
+ ontology_dict[evt_type]['template'].append(fields[1])
94
+ for i, arg in enumerate(arguments):
95
+ if arg != '':
96
+ # 事件类型下添加字典一项 arg1的值为arg
97
+ # x += 1
98
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
99
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
100
+ # 即扫描到的事件类型在 evt_type_dict.keys() 还未存在过
101
+ else:
102
+ # 建立该事件类型的key
103
+ ontology_dict[evt_type] = {}
104
+ arguments = fields[2:]
105
+ ontology_dict[evt_type]['template'] = []
106
+ ontology_dict[evt_type]['template'].append(fields[1])
107
+ for i, arg in enumerate(arguments):
108
+ if arg != '':
109
+ # 事件类型下添加字典一项 arg1的值为arg
110
+ # x += 1
111
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
112
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
113
+
114
+
115
+ examples = {}
116
+ #print(args)
117
+ print(args.gen_file)
118
+ # data/RAMS_1.0/data/test_head_coref.jsonlines
119
+ with open(args.test_file, 'r') as f:
120
+ for line in f:
121
+ ex = json.loads(line.strip())
122
+ ex['ref_evt_links'] = deepcopy(ex['gold_evt_links'])
123
+ ex['gold_evt_links'] = []
124
+ examples[ex['doc_key']] =ex
125
+
126
+ # checkpoints/gen-RAMS-pred/predictions.jsonl
127
+ with open(args.gen_file,'r') as f:
128
+ for line in f:
129
+ pred = json.loads(line.strip())
130
+ # print(pred)
131
+ examples[pred['doc_key']]['predicted'] = pred['predicted']
132
+ examples[pred['doc_key']]['gold'] = pred['gold']
133
+
134
+ # checkpoints/gen-RAMS-pred/out_put.jsonl
135
+ writer = open(args.output_file, 'w')
136
+ for ex in tqdm(examples.values()):
137
+ if 'predicted' not in ex:# this is used for testing
138
+ continue
139
+ # get template
140
+ evt_type = get_event_type(ex)[0]
141
+ context_words = [w for sent in ex['sentences'] for w in sent ]
142
+ template = ontology_dict[evt_type.replace('n/a','unspecified')]['template']
143
+ # extract argument text
144
+
145
+ predicted_args = extract_args_from_template(ex,template, ontology_dict)
146
+ # get trigger
147
+ # extract argument span
148
+ trigger_start = ex['evt_triggers'][0][0]
149
+ trigger_end = ex['evt_triggers'][0][1]
150
+ doc = None
151
+ if args.head_only:
152
+ doc = nlp(' '.join(context_words))
153
+
154
+ for argname in predicted_args:
155
+ arg_span = find_arg_span(predicted_args[argname], context_words,
156
+ trigger_start, trigger_end, head_only=args.head_only, doc=doc)
157
+ if arg_span:# if None means hullucination
158
+
159
+ if args.head_only and args.coref:
160
+ # consider coreferential mentions as matching
161
+ assert('corefs' in ex)
162
+ gold_spans = [a[1] for a in ex['ref_evt_links'] if a[2]==argname]
163
+ arg_span = check_coref(ex, list(arg_span), gold_spans)
164
+
165
+ ex['gold_evt_links'].append([[trigger_start, trigger_end], list(arg_span), argname])
166
+
167
+ writer.write(json.dumps(ex)+'\n')
168
+
169
+ writer.close()
170
+
171
+
172
+
src/genie/{data_module.py → question/data_module.py} RENAMED
@@ -101,18 +101,18 @@ class RAMSDataModule(pl.LightningDataModule):
101
 
102
  x = 1
103
  while(x > 0):
104
- print(ontology_dict)
105
  x = x - 1
106
  return ontology_dict
107
 
108
  def prepare_data(self):
109
- if not os.path.exists('preprocessed_data'):
110
- os.makedirs('preprocessed_data')
111
 
112
  ontology_dict = self.load_ontology()
113
 
114
  for split,f in [('train',self.hparams.train_file), ('val',self.hparams.val_file), ('test',self.hparams.test_file)]:
115
- with open(f,'r') as reader, open('preprocessed_data/{}.jsonl'.format(split), 'w') as writer:
116
  for lidx, line in enumerate(reader):
117
  ex = json.loads(line.strip())
118
  input_template, output_template, context= self.create_gold_gen(ex, ontology_dict, self.hparams.mark_trigger)
@@ -145,7 +145,7 @@ class RAMSDataModule(pl.LightningDataModule):
145
 
146
 
147
  def train_dataloader(self):
148
- dataset = IEDataset('preprocessed_data/train.jsonl')
149
 
150
  dataloader = DataLoader(dataset,
151
  pin_memory=True, num_workers=2,
@@ -156,7 +156,7 @@ class RAMSDataModule(pl.LightningDataModule):
156
 
157
 
158
  def val_dataloader(self):
159
- dataset = IEDataset('preprocessed_data/val.jsonl')
160
 
161
  dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
162
  collate_fn=my_collate,
@@ -164,7 +164,7 @@ class RAMSDataModule(pl.LightningDataModule):
164
  return dataloader
165
 
166
  def test_dataloader(self):
167
- dataset = IEDataset('preprocessed_data/test.jsonl')
168
 
169
  dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
170
  collate_fn=my_collate,
 
101
 
102
  x = 1
103
  while(x > 0):
104
+ #print(ontology_dict)
105
  x = x - 1
106
  return ontology_dict
107
 
108
  def prepare_data(self):
109
+ if not os.path.exists('span_preprocessed_data'):
110
+ os.makedirs('span_preprocessed_data')
111
 
112
  ontology_dict = self.load_ontology()
113
 
114
  for split,f in [('train',self.hparams.train_file), ('val',self.hparams.val_file), ('test',self.hparams.test_file)]:
115
+ with open(f,'r') as reader, open('span_preprocessed_data/{}.jsonl'.format(split), 'w') as writer:
116
  for lidx, line in enumerate(reader):
117
  ex = json.loads(line.strip())
118
  input_template, output_template, context= self.create_gold_gen(ex, ontology_dict, self.hparams.mark_trigger)
 
145
 
146
 
147
  def train_dataloader(self):
148
+ dataset = IEDataset('span_preprocessed_data/train.jsonl')
149
 
150
  dataloader = DataLoader(dataset,
151
  pin_memory=True, num_workers=2,
 
156
 
157
 
158
  def val_dataloader(self):
159
+ dataset = IEDataset('span_preprocessed_data/val.jsonl')
160
 
161
  dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
162
  collate_fn=my_collate,
 
164
  return dataloader
165
 
166
  def test_dataloader(self):
167
+ dataset = IEDataset('span_preprocessed_data/test.jsonl')
168
 
169
  dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
170
  collate_fn=my_collate,
src/genie/{data_module1.py → question/data_module1.py} RENAMED
@@ -96,6 +96,7 @@ class RAMSDataModule(pl.LightningDataModule):
96
  # 输出模板中的<arg1>等都替换为统一的<arg>
97
  output_template = re.sub(r'<arg\d>', '<arg>', template)
98
  space_tokenized_template = output_template.split(' ')
 
99
  tokenized_template = []
100
  for w in space_tokenized_template:
101
  tokenized_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
@@ -142,15 +143,15 @@ class RAMSDataModule(pl.LightningDataModule):
142
  return ontology_dict
143
 
144
  def prepare_data(self):
145
- #if not os.path.exists('preprocessed_data'):
146
- #os.makedirs('preprocessed_data')
147
 
148
  ontology_dict = self.load_ontology()
149
 
150
  #print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
151
  for split, f in [('train', self.hparams.train_file), ('val', self.hparams.val_file),
152
  ('test', self.hparams.test_file)]:
153
- with open(f, 'r') as reader, open('preprocessed_data/{}.jsonl'.format(split), 'w') as writer:
154
  for lidx, line in enumerate(reader):
155
  # 读取jsonlines中的每一行
156
  ex = json.loads(line.strip())
@@ -186,7 +187,7 @@ class RAMSDataModule(pl.LightningDataModule):
186
  writer.write(json.dumps(processed_ex) + "\n")
187
 
188
  def train_dataloader(self):
189
- dataset = IEDataset('preprocessed_data/train.jsonl')
190
 
191
  dataloader = DataLoader(dataset,
192
  pin_memory=True, num_workers=2,
@@ -196,7 +197,7 @@ class RAMSDataModule(pl.LightningDataModule):
196
  return dataloader
197
 
198
  def val_dataloader(self):
199
- dataset = IEDataset('preprocessed_data/val.jsonl')
200
 
201
  dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
202
  collate_fn=my_collate,
@@ -204,7 +205,7 @@ class RAMSDataModule(pl.LightningDataModule):
204
  return dataloader
205
 
206
  def test_dataloader(self):
207
- dataset = IEDataset('preprocessed_data/test.jsonl')
208
 
209
  dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
210
  collate_fn=my_collate,
 
96
  # 输出模板中的<arg1>等都替换为统一的<arg>
97
  output_template = re.sub(r'<arg\d>', '<arg>', template)
98
  space_tokenized_template = output_template.split(' ')
99
+ print(output_template)
100
  tokenized_template = []
101
  for w in space_tokenized_template:
102
  tokenized_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
 
143
  return ontology_dict
144
 
145
  def prepare_data(self):
146
+ if not os.path.exists('head_templates_preprocessed_data'):
147
+ os.makedirs('head_templates_preprocessed_data')
148
 
149
  ontology_dict = self.load_ontology()
150
 
151
  #print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
152
  for split, f in [('train', self.hparams.train_file), ('val', self.hparams.val_file),
153
  ('test', self.hparams.test_file)]:
154
+ with open(f, 'r') as reader, open('head_templates_preprocessed_data/{}.jsonl'.format(split), 'w') as writer:
155
  for lidx, line in enumerate(reader):
156
  # 读取jsonlines中的每一行
157
  ex = json.loads(line.strip())
 
187
  writer.write(json.dumps(processed_ex) + "\n")
188
 
189
  def train_dataloader(self):
190
+ dataset = IEDataset('head_templates_preprocessed_data/train.jsonl')
191
 
192
  dataloader = DataLoader(dataset,
193
  pin_memory=True, num_workers=2,
 
197
  return dataloader
198
 
199
  def val_dataloader(self):
200
+ dataset = IEDataset('head_templates_preprocessed_data/val.jsonl')
201
 
202
  dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
203
  collate_fn=my_collate,
 
205
  return dataloader
206
 
207
  def test_dataloader(self):
208
+ dataset = IEDataset('head_templates_preprocessed_data/test.jsonl')
209
 
210
  dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
211
  collate_fn=my_collate,
src/genie/question/data_module2.py ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import jsonlines
4
+ import re
5
+ import random
6
+ from collections import defaultdict
7
+ import argparse
8
+
9
+ import transformers
10
+ from transformers import BartTokenizer
11
+ import torch
12
+ from torch.utils.data import DataLoader
13
+ import pytorch_lightning as pl
14
+
15
+ from .data import IEDataset, my_collate
16
+
17
+ MAX_LENGTH = 424
18
+ MAX_TGT_LENGTH = 72
19
+ DOC_STRIDE = 256
20
+
21
+ print("data_module2.py")
22
+ class RAMSDataModule(pl.LightningDataModule):
23
+ def __init__(self, args):
24
+ super().__init__()
25
+ self.hparams = args
26
+ self.tokenizer = BartTokenizer.from_pretrained('facebook/bart-large')
27
+ self.tokenizer.add_tokens([' <arg>', ' <tgr>'])
28
+
29
+ def get_event_type(self, ex):
30
+ evt_type = []
31
+ for evt in ex['evt_triggers']:
32
+ for t in evt[2]:
33
+ evt_type.append(t[0])
34
+ return evt_type
35
+ # 获取标签数据
36
+
37
+ def create_gold_gen(self, ex, ontology_dict, mark_trigger=True):
38
+ '''assumes that each line only contains 1 event.
39
+ Input: <s> Template with special <arg> placeholders </s> </s> Passage </s>
40
+ Output: <s> Template with arguments and <arg> when no argument is found.
41
+ '''
42
+ # 目前的模板: what is the <arg> in <trg>
43
+ # 设置三个总列表、存放输入模板、输出模板
44
+ INPUT = []
45
+ OUTPUT = []
46
+ CONTEXT = []
47
+ # ex 是json数据
48
+ # 得到每条数据的事件类型
49
+ evt_type = self.get_event_type(ex)[0]
50
+ # 将文档中的每个单词取出放入context_words这个新建列表里
51
+ context_words = [w for sent in ex['sentences'] for w in sent]
52
+ # 从事件本体中取出事件模板 有的事件类型模板做特殊处理
53
+ # 新建立的onto_logy_dict中的模板template是一个列表 每次需要取其中一个
54
+ template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
55
+ # 将占位符 <trg> 用 trigger进行替换
56
+ trigger_index = ex['evt_triggers'][0][0]
57
+ # trg就是本条json下的触发词
58
+ trg = context_words[trigger_index]
59
+ i = 0
60
+ # 这里需要遍历整个列表 将其中每个模板中的trg进行替换 template是一个列表
61
+ for x in range(len(template)):
62
+ template[x] = re.sub(r'<trg>', trg, template[x])
63
+ i += 1
64
+ # 将输入模板中的arg1 arg2等编号论元全部替换为统一的 <arg> 和上面一样需要重新修改
65
+ # for x in template:
66
+ # x = re.sub(r'<arg\d>', '<arg>', x)
67
+ # 转换之后 template变为['what is the <arg> in trg', 'what is the <arg> in trg']
68
+ input_template = re.sub(r'<arg\d', '<arg>', template[0])
69
+
70
+ # 将模板进行分词
71
+ space_tokenized_input_template = input_template.split(' ')
72
+ # 分词后存储的列表
73
+ tokenized_input_template = []
74
+ # 将每个单词进行分词后添加到上面这个列表中
75
+ for w in space_tokenized_input_template:
76
+ tokenized_input_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
77
+ for j in range(i):
78
+ INPUT.append(tokenized_input_template)
79
+ # input_template 的值应该固定为 what is the <arg> in trg
80
+ # 将原数据集中的json取出后, 其中的template列表不应该变化
81
+ # 获取三元组 构建输出模板 即标签
82
+ for lidx, triple in enumerate(ex['gold_evt_links']):
83
+ # 触发词 论元 论元
84
+ # 例子: "gold_evt_links":
85
+ # [[[40, 40], [33, 33], "evt089arg01victim"],
86
+ # [[40, 40], [28, 28], "evt089arg02place"]]
87
+ #print(triple)
88
+ trigger_span, argument_span, arg_name = triple
89
+ # 第几个论元
90
+ #print(evt_type)
91
+ arg_num = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_name]
92
+ # 具体论元内容 短语
93
+ arg_text = ' '.join(context_words[argument_span[0]:argument_span[1] + 1])
94
+ # 通过正则表达式的方式将模板中的每个<arg> 替换为具体的论元内容
95
+ # 按照顺序将列表中的<arg>依次替换为
96
+ template[lidx] = re.sub('<{}>'.format(arg_num), arg_text, template[lidx])
97
+
98
+
99
+ #print(template)
100
+ trigger = ex['evt_triggers'][0]
101
+ if mark_trigger:
102
+ trigger_span_start = trigger[0]
103
+ trigger_span_end = trigger[1] + 2 # one for inclusion, one for extra start marker
104
+ # 触发词之前的单词
105
+ prefix = self.tokenizer.tokenize(' '.join(context_words[:trigger[0]]), add_prefix_space=True)
106
+ # 触发词短语
107
+ tgt = self.tokenizer.tokenize(' '.join(context_words[trigger[0]: trigger[1] + 1]), add_prefix_space=True)
108
+ # 触发词之后的单词
109
+ suffix = self.tokenizer.tokenize(' '.join(context_words[trigger[1] + 1:]), add_prefix_space=True)
110
+ context = prefix + [' <tgr>', ] + tgt + [' <tgr>', ] + suffix
111
+ else:
112
+ context = self.tokenizer.tokenize(' '.join(context_words), add_prefix_space=True)
113
+ # 将context放入CONTEXT中
114
+ for w in range(i):
115
+ CONTEXT.append(context)
116
+ # 输出模板中的<arg1>等都替换为统一的<arg>
117
+ # 构建输出模板 template
118
+ # output_template 的构建需要循环输出 此时的template中的内容已经替换为文本中应该抽取的论文短语
119
+ # 下面这个循环不是很懂什么意思
120
+ # 建立一个output_template
121
+ output_template = []
122
+ for i in range(len(template)):
123
+ output_template.append(re.sub(r'<arg\d>', '<arg>', template[i]))
124
+ # 此时的output_template(列表)中的内容存放的是应该生成的template标签模板
125
+ # output_template = re.sub(r'<arg\d>', '<arg>', template)
126
+ # 使用一个新的space_tokenized_template 来存放分词后的每个template标签模板
127
+ space_tokenized_template = []
128
+ for i in range(len(output_template)):
129
+ space_tokenized_template.append(output_template[i].split())
130
+ # space_tokenized_template = output_template.split(' ')
131
+ #print(space_tokenized_template)
132
+ tokenized_template = []
133
+ # 此时的space_tokenized_template[[],[],[]]
134
+ # len == 5 此时遍历每一个分词后的模板(已填充)
135
+ for i in range(len(space_tokenized_template)):
136
+ for w in space_tokenized_template[i]:
137
+ tokenized_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
138
+ #print(tokenized_template)
139
+ OUTPUT.append(tokenized_template)
140
+ tokenized_template = []
141
+ #print(OUTPUT)
142
+ # for w in space_tokenized_template:
143
+ # tokenized_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
144
+
145
+ return INPUT, OUTPUT, CONTEXT
146
+
147
+ def load_ontology(self):
148
+ # read ontology
149
+ ontology_dict = {}
150
+ with open('aida_ontology_new.csv', 'r') as f:
151
+ for lidx, line in enumerate(f):
152
+ if lidx == 0: # header
153
+ continue
154
+ fields = line.strip().split(',')
155
+ if len(fields) < 2:
156
+ break
157
+ # 获取事件类型
158
+ evt_type = fields[0]
159
+ # 得到该事件类型下的所有论元类型
160
+ args = fields[2:]
161
+ # 将事件本体字典中添加事件类型的key,该key下对应的value为模板
162
+ # 利用args_len将template中的子模板数量进行循环增加, 将后续的子模板通过字符串拼接的方式进行增加
163
+ # 最终的模板样式变为 what is the <arg1> in <trg> what is the <arg2> in <trg>
164
+ # 先利用一个临时的字符串变量来存储模板 ----------> temp_template
165
+ temp_template = []
166
+ for i in range(len(args)):
167
+ temp_template.append("what is the <arg{}> in <trg>".format(i+1))
168
+ # for i in range(args_len):
169
+ # temp_template = temp_template + " what is the <arg{}> in <trg>".format(i + 1)
170
+ # 将事件本体字典中添加事件类型的key,该key下对应的value为模板
171
+ ontology_dict[evt_type] = {
172
+ 'template': temp_template
173
+ }
174
+ # 对每个论元类型进行遍历
175
+ for i, arg in enumerate(args):
176
+ if arg != '':
177
+ # 事件类型下添加字典一项 arg1的值为arg
178
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
179
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
180
+
181
+ return ontology_dict
182
+
183
+ def prepare_data(self):
184
+ #if not os.path.exists('head_templates_preprocessed_data_new'):
185
+ #os.makedirs('head_templates_preprocessed_data_new')
186
+
187
+ ontology_dict = self.load_ontology()
188
+
189
+ #print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
190
+ for split, f in [('train', self.hparams.train_file), ('val', self.hparams.val_file),
191
+ ('test', self.hparams.test_file)]:
192
+ with open(f, 'r') as reader, open('head_templates_preprocessed_data_new/{}.jsonl'.format(split), 'w') as writer:
193
+ for lidx, line in enumerate(reader):
194
+ # 读取jsonlines中的每一行
195
+ ex = json.loads(line.strip())
196
+ # 输入模板 应该输出的模板 文本
197
+ # 在输入到函数进行处理之后 应该进行一个arg对应一个输入模板、一个输出模板以及一个文本
198
+ # 可以选择以列表的形式进行返回
199
+ input_template, output_template, context = self.create_gold_gen(ex, ontology_dict,
200
+ self.hparams.mark_trigger)
201
+
202
+ # 返回所有的编码信息
203
+ # 返回的是三个列表 INPUT OUTPUT CONTEXT 这三个列表的长度相等 举个例子 列表长度为3
204
+ length = len(input_template)
205
+ #print(output_template)
206
+ for i in range(length):
207
+ input_tokens = self.tokenizer.encode_plus(input_template[i], context[i],
208
+ add_special_tokens=True,
209
+ add_prefix_space=True,
210
+ max_length=MAX_LENGTH,
211
+ truncation='only_second',
212
+ padding='max_length')
213
+ # target_tokens
214
+ tgt_tokens = self.tokenizer.encode_plus(output_template[i],
215
+ add_special_tokens=True,
216
+ add_prefix_space=True,
217
+ max_length=MAX_TGT_LENGTH,
218
+ truncation=True,
219
+ padding='max_length')
220
+ # input_ids 单词在词典中的编码
221
+ # tgt_tokens 指定对哪些词进行self_attention操作
222
+ processed_ex = {
223
+ # 'idx': lidx,
224
+ 'doc_key': ex['doc_key'],
225
+ 'input_token_ids': input_tokens['input_ids'],
226
+ 'input_attn_mask': input_tokens['attention_mask'],
227
+ 'tgt_token_ids': tgt_tokens['input_ids'],
228
+ 'tgt_attn_mask': tgt_tokens['attention_mask'],
229
+ }
230
+ #print(processed_ex)
231
+ writer.write(json.dumps(processed_ex) + "\n")
232
+
233
+ def train_dataloader(self):
234
+ dataset = IEDataset('head_templates_preprocessed_data_new/train.jsonl')
235
+
236
+ dataloader = DataLoader(dataset,
237
+ pin_memory=True, num_workers=2,
238
+ collate_fn=my_collate,
239
+ batch_size=self.hparams.train_batch_size,
240
+ shuffle=True)
241
+ return dataloader
242
+
243
+ def val_dataloader(self):
244
+ dataset = IEDataset('head_templates_preprocessed_data_new/val.jsonl')
245
+
246
+ dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
247
+ collate_fn=my_collate,
248
+ batch_size=self.hparams.eval_batch_size, shuffle=False)
249
+ return dataloader
250
+
251
+ def test_dataloader(self):
252
+ dataset = IEDataset('head_templates_preprocessed_data_new/test.jsonl')
253
+
254
+ dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
255
+ collate_fn=my_collate,
256
+ batch_size=self.hparams.eval_batch_size, shuffle=False)
257
+
258
+ return dataloader
259
+
260
+
261
+ if __name__ == '__main__':
262
+ parser = argparse.ArgumentParser()
263
+ parser.add_argument('--train-file', type=str, default='data/RAMS_1.0/data/train.jsonlines')
264
+ parser.add_argument('--val-file', type=str, default='data/RAMS_1.0/data/dev.jsonlines')
265
+ parser.add_argument('--test-file', type=str, default='data/RAMS_1.0/data/test.jsonlines')
266
+ parser.add_argument('--train_batch_size', type=int, default=2)
267
+ parser.add_argument('--eval_batch_size', type=int, default=4)
268
+ parser.add_argument('--mark-trigger', action='store_true', default=True)
269
+ args = parser.parse_args()
270
+
271
+ print("data_module1.pyaaaaaaaaaaaaaaa")
272
+ dm = RAMSDataModule(args=args)
273
+ dm.prepare_data()
274
+
275
+ # training dataloader
276
+ dataloader = dm.train_dataloader()
277
+
278
+ for idx, batch in enumerate(dataloader):
279
+ print(batch)
280
+ break
281
+
282
+ # val dataloader
src/genie/question/data_module3.py ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import jsonlines
4
+ import re
5
+ import random
6
+ from collections import defaultdict
7
+ import argparse
8
+
9
+ import transformers
10
+ from transformers import BartTokenizer
11
+ import torch
12
+ from torch.utils.data import DataLoader
13
+ import pytorch_lightning as pl
14
+
15
+ from .data import IEDataset, my_collate
16
+
17
+ MAX_LENGTH = 424
18
+ MAX_TGT_LENGTH = 72
19
+ DOC_STRIDE = 256
20
+
21
+ print("data_module3.py")
22
+ class RAMSDataModule(pl.LightningDataModule):
23
+ def __init__(self, args):
24
+ super().__init__()
25
+ self.hparams = args
26
+ self.tokenizer = BartTokenizer.from_pretrained('facebook/bart-large')
27
+ self.tokenizer.add_tokens([' <arg>', ' <tgr>'])
28
+
29
+ def get_event_type(self, ex):
30
+ evt_type = []
31
+ for evt in ex['evt_triggers']:
32
+ for t in evt[2]:
33
+ evt_type.append(t[0])
34
+ return evt_type
35
+ # 获取标签数据
36
+
37
+ def create_gold_gen(self, ex, ontology_dict, mark_trigger=True):
38
+ '''assumes that each line only contains 1 event.
39
+ Input: <s> Template with special <arg> placeholders </s> </s> Passage </s>
40
+ Output: <s> Template with arguments and <arg> when no argument is found.
41
+ '''
42
+ # 设置三个总列表、存放输入模板、输出模板
43
+ INPUT = []
44
+ OUTPUT = []
45
+ CONTEXT = []
46
+ # ex 是json数据
47
+ # 得到每条数据的事件类型
48
+ evt_type = self.get_event_type(ex)[0]
49
+ # 将文档中的每个单词取出放入context_words这个新建列表里
50
+ context_words = [w for sent in ex['sentences'] for w in sent]
51
+ # 从事件本体中取出事件模板 有的事件类型模板做特殊处理
52
+ # 新建立的onto_logy_dict中的模板template是一个列表 每次需要取其中一个
53
+ template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
54
+ # 将占位符 <trg> 用 trigger进行替换
55
+ trigger_index = ex['evt_triggers'][0][0]
56
+ # trg就是本条json下的触发词
57
+ trg = context_words[trigger_index]
58
+ i = 0
59
+ # 这里需要遍历整个列表 将其中每个模板中的trg进行替换 template是一个列表
60
+ for x in range(len(template)):
61
+ template[x] = re.sub(r'<trg>', trg, template[x])
62
+ i += 1
63
+ # 将输入模板中的arg1 arg2等编号论元全部替换为统一的 <arg> 和上面一样需要重新修改
64
+ # for x in template:
65
+ # x = re.sub(r'<arg\d>', '<arg>', x)
66
+ # 转换之后 template变为['what is the <arg> in trg', 'what is the <arg> in trg']
67
+ input_template = re.sub(r'<arg\d', '<arg>', template[0])
68
+
69
+ # 将模板进行分词
70
+ space_tokenized_input_template = input_template.split(' ')
71
+ # 分词后存储的列表
72
+ tokenized_input_template = []
73
+ # 将每个单词进行分词后添加到上面这个列表中
74
+ for w in space_tokenized_input_template:
75
+ tokenized_input_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
76
+ for j in range(i):
77
+ INPUT.append(tokenized_input_template)
78
+ # input_template 的值应该固定为 what is the <arg> in trg
79
+ # 将原数据集中的json取出后, 其中的template列表不应该变化
80
+ # 获取三元组 构建输出模板 即标签
81
+ for lidx, triple in enumerate(ex['gold_evt_links']):
82
+ # 触发词 论元 论元
83
+ # 例子: "gold_evt_links":
84
+ # [[[40, 40], [33, 33], "evt089arg01victim"],
85
+ # [[40, 40], [28, 28], "evt089arg02place"]]
86
+ trigger_span, argument_span, arg_name = triple
87
+ # 第几个论元
88
+
89
+ arg_num = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_name]
90
+ # 具体论元内容 短语
91
+ arg_text = ' '.join(context_words[argument_span[0]:argument_span[1] + 1])
92
+ # 通过正则表达式的方式将模板中的每个<arg> 替换为具体的论元内容
93
+ # 按照顺序将列表中的<arg>依次替换为
94
+ template[lidx] = re.sub('<{}>'.format(arg_num), arg_text, template[lidx])
95
+
96
+
97
+ trigger = ex['evt_triggers'][0]
98
+ if mark_trigger:
99
+ trigger_span_start = trigger[0]
100
+ trigger_span_end = trigger[1] + 2 # one for inclusion, one for extra start marker
101
+ # 触发词之前的单词
102
+ prefix = self.tokenizer.tokenize(' '.join(context_words[:trigger[0]]), add_prefix_space=True)
103
+ # 触发词短语
104
+ tgt = self.tokenizer.tokenize(' '.join(context_words[trigger[0]: trigger[1] + 1]), add_prefix_space=True)
105
+ # 触发词之后的单词
106
+ suffix = self.tokenizer.tokenize(' '.join(context_words[trigger[1] + 1:]), add_prefix_space=True)
107
+ context = prefix + [' <tgr>', ] + tgt + [' <tgr>', ] + suffix
108
+ else:
109
+ context = self.tokenizer.tokenize(' '.join(context_words), add_prefix_space=True)
110
+ # 将context放入CONTEXT中
111
+ for w in range(i):
112
+ CONTEXT.append(context)
113
+ # 输出模板中的<arg1>等都替换为统一的<arg>
114
+ # 构建输出模板 template
115
+ # output_template 的构建需要循环输出 此时的template中的内容已经替换为文本中应该抽取的论文短语
116
+ # 下面这个循环不是很懂什么意思
117
+ # 建立一个output_template
118
+ output_template = []
119
+ for i in range(len(template)):
120
+ output_template.append(re.sub(r'<arg\d>', '<arg>', template[i]))
121
+ # 此时的output_template(列表)中的内容存放的是应该生成的template标签模板
122
+ # output_template = re.sub(r'<arg\d>', '<arg>', template)
123
+ # 使用一个新的space_tokenized_template 来存放分词后的每个template标签模板
124
+ space_tokenized_template = []
125
+ for i in range(len(output_template)):
126
+ space_tokenized_template.append(output_template[i].split())
127
+ # space_tokenized_template = output_template.split(' ')
128
+ tokenized_template = []
129
+ # 此时的space_tokenized_template[[],[],[]]
130
+ for i in range(len(space_tokenized_template)):
131
+ for w in space_tokenized_template[i]:
132
+ tokenized_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
133
+ OUTPUT.append(tokenized_input_template)
134
+ tokenized_template = []
135
+ # for w in space_tokenized_template:
136
+ # tokenized_template.extend(self.tokenizer.tokenize(w, add_prefix_space=True))
137
+
138
+ return INPUT, OUTPUT, CONTEXT
139
+
140
+ def load_ontology(self):
141
+ # read ontology
142
+ # 每个事件类型根据它需要生成的论元数量的不同拆分成相应数量的模板数
143
+ # 举个例子 : 一条json数据 事件类型是evt_type 需要生成三个论元arg1 arg2 arg3
144
+ # evt_type template1 arg1
145
+ # evt_type template2 arg2
146
+ # evt_type template3 arg3
147
+ # 建立一个字典 每次遍历表格中的行时,针对事件类型的不同 填入字典 在下一次的遍历中如果存在则填入ontology_dict中
148
+ ontology_dict = {}
149
+ # 设立一个字典进行判断 如果扫描的事件类型已经存在
150
+ # evt_type_dict = {}
151
+ with open('aida_ontology_fj-5.csv', 'r') as f:
152
+ # 其中lidx是索引 line 是每一行的数据
153
+ for lidx, line in enumerate(f):
154
+ if lidx == 0: # header
155
+ continue
156
+ fields = line.strip().split(',')
157
+ if len(fields) < 2:
158
+ break
159
+ # 获取事件类型
160
+ evt_type = fields[0]
161
+ # 如果该事件类型已经存在过
162
+ if evt_type in ontology_dict.keys():
163
+ # 得到该事件类型下的所有论元类型
164
+ args = fields[2:]
165
+ # 将该事件类型对应的模板中的论元模板 填充到onto_logy字典中
166
+ ontology_dict[evt_type]['template'].append(fields[1])
167
+ for i, arg in enumerate(args):
168
+ if arg != '':
169
+ # 事件类型下添加字典一项 arg1的值为arg
170
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
171
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
172
+ # 即扫描到的事件类型在 evt_type_dict.keys() 还未存在过
173
+ else:
174
+ # 建立该事件类型的key
175
+ ontology_dict[evt_type] = {}
176
+ args = fields[2:]
177
+ ontology_dict[evt_type]['template'] = []
178
+ ontology_dict[evt_type]['template'].append(fields[1])
179
+ for i, arg in enumerate(args):
180
+ if arg != '':
181
+ # 事件类型下添加字典一项 arg1的值为arg
182
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
183
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
184
+
185
+ return ontology_dict
186
+
187
+ def prepare_data(self):
188
+ #if not os.path.exists('head_templates_preprocessed_data'):
189
+ #os.makedirs('head_templates_preprocessed_data')
190
+
191
+ ontology_dict = self.load_ontology()
192
+
193
+ #print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
194
+ for split, f in [('train', self.hparams.train_file), ('val', self.hparams.val_file),
195
+ ('test', self.hparams.test_file)]:
196
+ with open(f, 'r') as reader, open('head_templates_preprocessed_data_new/{}.jsonl'.format(split), 'w') as writer:
197
+ for lidx, line in enumerate(reader):
198
+ # 读取jsonlines中的每一行
199
+ ex = json.loads(line.strip())
200
+ # 输入模板 应该输出的模板 文本
201
+ # 在输入到函数进行处理之后 应该进行一个arg对应一个���入模板、一个输出模板以及一个文本
202
+ # 可以选择以列表的形式进行返回
203
+ input_template, output_template, context = self.create_gold_gen(ex, ontology_dict,
204
+ self.hparams.mark_trigger)
205
+
206
+ # 返回所有的编码信息
207
+ # 返回的是三个列表 INPUT OUTPUT CONTEXT 这三个列表的长度相等 举个例子 列表长度为3
208
+ length = len(input_template)
209
+ for i in range(length):
210
+ input_tokens = self.tokenizer.encode_plus(input_template[i], context[i],
211
+ add_special_tokens=True,
212
+ add_prefix_space=True,
213
+ max_length=MAX_LENGTH,
214
+ truncation='only_second',
215
+ padding='max_length')
216
+ # target_tokens
217
+ tgt_tokens = self.tokenizer.encode_plus(output_template[i],
218
+ add_special_tokens=True,
219
+ add_prefix_space=True,
220
+ max_length=MAX_TGT_LENGTH,
221
+ truncation=True,
222
+ padding='max_length')
223
+ # input_ids 单词在词典中的编码
224
+ # tgt_tokens 指定对哪些词进行self_attention操作
225
+ processed_ex = {
226
+ # 'idx': lidx,
227
+ 'doc_key': ex['doc_key'],
228
+ 'input_token_ids': input_tokens['input_ids'],
229
+ 'input_attn_mask': input_tokens['attention_mask'],
230
+ 'tgt_token_ids': tgt_tokens['input_ids'],
231
+ 'tgt_attn_mask': tgt_tokens['attention_mask'],
232
+ }
233
+ #print(processed_ex)
234
+ writer.write(json.dumps(processed_ex) + "\n")
235
+
236
+ def train_dataloader(self):
237
+ dataset = IEDataset('head_templates_preprocessed_data_new/train.jsonl')
238
+
239
+ dataloader = DataLoader(dataset,
240
+ pin_memory=True, num_workers=2,
241
+ collate_fn=my_collate,
242
+ batch_size=self.hparams.train_batch_size,
243
+ shuffle=True)
244
+ return dataloader
245
+
246
+ def val_dataloader(self):
247
+ dataset = IEDataset('head_templates_preprocessed_data_new/val.jsonl')
248
+
249
+ dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
250
+ collate_fn=my_collate,
251
+ batch_size=self.hparams.eval_batch_size, shuffle=False)
252
+ return dataloader
253
+
254
+ def test_dataloader(self):
255
+ dataset = IEDataset('head_templates_preprocessed_data_new/test.jsonl')
256
+
257
+ dataloader = DataLoader(dataset, pin_memory=True, num_workers=2,
258
+ collate_fn=my_collate,
259
+ batch_size=self.hparams.eval_batch_size, shuffle=False)
260
+
261
+ return dataloader
262
+
263
+
264
+ if __name__ == '__main__':
265
+ parser = argparse.ArgumentParser()
266
+ parser.add_argument('--train-file', type=str, default='data/RAMS_1.0/data/train.jsonlines')
267
+ parser.add_argument('--val-file', type=str, default='data/RAMS_1.0/data/dev.jsonlines')
268
+ parser.add_argument('--test-file', type=str, default='data/RAMS_1.0/data/test.jsonlines')
269
+ parser.add_argument('--train_batch_size', type=int, default=2)
270
+ parser.add_argument('--eval_batch_size', type=int, default=4)
271
+ parser.add_argument('--mark-trigger', action='store_true', default=True)
272
+ args = parser.parse_args()
273
+
274
+ print("data_module1.pyaaaaaaaaaaaaaaa")
275
+ dm = RAMSDataModule(args=args)
276
+ dm.prepare_data()
277
+
278
+ # training dataloader
279
+ dataloader = dm.train_dataloader()
280
+
281
+ for idx, batch in enumerate(dataloader):
282
+ print(batch)
283
+ break
284
+
285
+ # val dataloader
src/genie/{convert_gen_to_output.py → temp/convert_gen_to_output.py} RENAMED
File without changes
src/genie/{convert_gen_to_output1.py → temp/convert_gen_to_output1.py} RENAMED
File without changes
src/genie/! ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import argparse
4
+ import re
5
+ from copy import deepcopy
6
+ from tqdm import tqdm
7
+
8
+ from utils import find_head, WhitespaceTokenizer, find_arg_span
9
+ import spacy
10
+ print("convert_gen_to_output5.py")
11
+ def extract_args_from_template(ex, template, ontology_dict,):
12
+ # extract argument text
13
+ # 这个函数的返回值是一个字典 因此需要 template列表和ex中的predicted列表同时进行遍历放入字典中
14
+ # 在这里定义两个列表 分别存放 定义存放模板的列表 TEMPLATE 和 相对应的生成 PREDICTED
15
+ # 传过来的参数中的template就是包含所有模板的列表 因此不需要再定义TEMPLATE 还是需要定义一个存放分词后的template
16
+ # 这里的template是相应事件类型下的模板包含多个
17
+ # 原来处理的方式是一个数据和一个综合性模板 现在模板是分开的 为什么要把template传过来 这不是脱裤子放屁的操作?
18
+ # 下面这段操作是因为上次模板的定义是相同因此只需要去列表中的第一个模板就行 这次需要用循环进行遍历
19
+ t = []
20
+ TEMPLATE = []
21
+ for i in template:
22
+ t = i.strip().split()
23
+ TEMPLATE.append(t)
24
+ t = []
25
+ # 到此为止 得到存放该ex即该数据类型下的所有模板的分词后的列表存储 下面获取对应的predicted同理
26
+ PREDICTED = []
27
+ p = []
28
+ for i in ex['predicted']:
29
+ p = i.strip().split()
30
+ PREDICTED.append(p)
31
+ p = []
32
+ # 这个字典变量定义了这个函数的返回值 应该是论元角色-论元短语的key-value映射
33
+ predicted_args = {}
34
+ evt_type = get_event_type(ex)[0]
35
+ # 不出意外的话 TEMPLATE和PREDICTED的长度应该是相等的
36
+ length = len(TEMPLATE)
37
+ for i in range(length):
38
+ template_words = TEMPLATE[i]
39
+ predicted_words = PREDICTED[i]
40
+ t_ptr = 0
41
+ p_ptr = 0
42
+ while t_ptr < len(template_words) and p_ptr < len(predicted_words):
43
+ if re.match(r'<(arg\d+)>', template_words[t_ptr]):
44
+ m = re.match(r'<(arg\d+)>', template_words[t_ptr])
45
+ # 这一步的操作是从模板中到 <arg1> 这样的词符 即arg_num 然后通过arg_num找到对应论元角色arg_name
46
+ arg_num = m.group(1)
47
+ arg_name = ontology_dict[evt_type.replace('n/a', 'unspecified')][arg_num]
48
+
49
+ if predicted_words[p_ptr] == '<arg>':
50
+ # missing argument
51
+ p_ptr +=1
52
+ t_ptr +=1
53
+ else:
54
+ arg_start = p_ptr
55
+ if t_ptr + 1 == len(template_words):
56
+ while p_ptr < len(predicted_words):
57
+ p_ptr += 1
58
+ else:
59
+ while (p_ptr < len(predicted_words)) and (predicted_words[p_ptr] != template_words[t_ptr+1]):
60
+ p_ptr += 1
61
+ arg_text = predicted_words[arg_start:p_ptr]
62
+ predicted_args[arg_name] = arg_text
63
+ t_ptr += 1
64
+ # aligned
65
+ else:
66
+ t_ptr += 1
67
+ p_ptr += 1
68
+
69
+ return predicted_args
70
+
71
+ def get_event_type(ex):
72
+ evt_type = []
73
+ for evt in ex['evt_triggers']:
74
+ for t in evt[2]:
75
+ evt_type.append( t[0])
76
+ return evt_type
77
+
78
+ def check_coref(ex, arg_span, gold_spans):
79
+ for clus in ex['corefs']:
80
+ if arg_span in clus:
81
+ matched_gold_spans = [span for span in gold_spans if span in clus]
82
+ if len(matched_gold_spans) > 0:
83
+ return matched_gold_spans[0]
84
+ return arg_span
85
+
86
+ if __name__ == '__main__':
87
+ parser = argparse.ArgumentParser()
88
+ parser.add_argument('--gen-file',type=str, default='checkpoints/gen-new-tokenization-pred/sample_predictions.jsonl')
89
+ parser.add_argument('--test-file', type=str,default='data/RAMS_1.0/data/test.jsonlines')
90
+ parser.add_argument('--output-file',type=str, default='test_output.jsonl')
91
+ parser.add_argument('--ontology-file',type=str, default='aida_ontology_new.csv')
92
+ parser.add_argument('--head-only',action='store_true',default=False)
93
+ parser.add_argument('--coref', action='store_true', default=False)
94
+ args = parser.parse_args()
95
+
96
+ # 加载词典
97
+ nlp = spacy.load('en_core_web_sm')
98
+ nlp.tokenizer = WhitespaceTokenizer(nlp.vocab)
99
+ # read ontology 读取事件本体 模板文件中的内容
100
+ ontology_dict = {}
101
+ with open('aida_ontology_fj-5.csv', 'r') as f:
102
+ for lidx, line in enumerate(f):
103
+ if lidx == 0: # header
104
+ continue
105
+ fields = line.strip().split(',')
106
+ if len(fields) < 2:
107
+ break
108
+ evt_type = fields[0]
109
+ if evt_type in ontology_dict.keys():
110
+ arguments = fields[2:]
111
+ ontology_dict[evt_type]['template'].append(fields[1])
112
+ for i, arg in enumerate(arguments):
113
+ if arg != '':
114
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
115
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
116
+ else:
117
+ ontology_dict[evt_type] = {}
118
+ arguments = fields[2:]
119
+ ontology_dict[evt_type]['template'] = []
120
+ ontology_dict[evt_type]['template'].append(fields[1])
121
+ for i, arg in enumerate(arguments):
122
+ if arg != '':
123
+ ontology_dict[evt_type]['arg{}'.format(i + 1)] = arg
124
+ ontology_dict[evt_type][arg] = 'arg{}'.format(i + 1)
125
+ examples = {}
126
+ print(args.gen_file)
127
+ # data/RAMS_1.0/data/test_head_coref.jsonlines
128
+ key = []
129
+ with open(args.test_file, 'r') as f:
130
+ for line in f:
131
+ ex = json.loads(line.strip())
132
+ #if ex['gold_evt_links'] == []:
133
+ #key.append(ex['doc_key'])
134
+ #continue
135
+ ex['ref_evt_links'] = deepcopy(ex['gold_evt_links'])
136
+ ex['gold_evt_links'] = []
137
+ examples[ex['doc_key']] = ex
138
+
139
+ # checkpoints/gen-RAMS-pred/predictions.jsonl
140
+ flag = {}
141
+ with open(args.gen_file,'r') as f:
142
+ for line in f:
143
+ pred = json.loads(line.strip())
144
+ # print(pred)
145
+ # 因为最后生成 应该是 多个相同的事件类型在并列 这个操作好像把已经填入的predicte覆盖掉了
146
+ # 在这里的循环中 应该继续向下扫描 采取和ontology中相同的处理方式 用列表的方式存储将pred中的内容存放到examples中的数据中
147
+ # pred 是对预测文件中的预测结果句用空格进行分隔单词后的结果
148
+ # pred中的内容主要包括 doc_key predicted gold
149
+ # 如果扫描到的预测json数据事件类型在examples中存在 那么就将predicted存入列表
150
+ # if pred['doc_key'] not in key:
151
+ if pred['doc_key'] in flag.keys():
152
+ #print(examples[pred['doc_key']]['predicted'])
153
+ examples[pred['doc_key']]['predicted'].append(pred['predicted'])
154
+ examples[pred['doc_key']]['gold'].append(pred['gold'])
155
+ # 如果没有 说明这是新的事件类型
156
+ else:
157
+ flag[pred['doc_key']] = True
158
+ examples[pred['doc_key']]['predicted'] = []
159
+ examples[pred['doc_key']]['gold'] = []
160
+ # 然后将此条数据存入
161
+ examples[pred['doc_key']]['predicted'].append(pred['predicted'])
162
+ examples[pred['doc_key']]['gold'].append(pred['gold'])
163
+
164
+ # checkpoints/gen-RAMS-pred/out_put.jsonl
165
+ writer = open(args.output_file, 'w')
166
+ for ex in tqdm(examples.values()):
167
+ if 'predicted' not in ex:# this is used for testing
168
+ continue
169
+ # get template 获取事件类型
170
+ evt_type = get_event_type(ex)[0]
171
+ context_words = [w for sent in ex['sentences'] for w in sent]
172
+ # 这里的template是ontology_dict中 template 包含一个事件类型下的所有事件模板
173
+ template = ontology_dict[evt_type.replace('n/a', 'unspecified')]['template']
174
+ # extract argument text
175
+ # 这里应该是提取预测文件中预测到的论元短语 ex是一条json数据 template是这条json数据对应下的模板 on是论元角色和<arg1>的映射
176
+ # 这里ex中的predicted和gold已经包括了该事件类型下的所有论元 用列表的形式进行存储 且顺序是一一对应的
177
+ # 这里返回的predicted_args是一个字典:
178
+ predicted_args = extract_args_from_template(ex, template, ontology_dict)
179
+ # get trigger
180
+ # extract argument span 找出触发词在文段中的索引
181
+ str_p = ''
182
+ str_g = ''
183
+ for i in range(len(ex['predicted'])):
184
+ str_p += ex['predicted'][i]
185
+ str_g += ex['gold'][i]
186
+
187
+ ex['predicted'] = str_p
188
+ ex['gold'] = str_g
189
+ trigger_start = ex['evt_triggers'][0][0]
190
+ trigger_end = ex['evt_triggers'][0][1]
191
+ # 上面返回的predicted_args是一个字典 暂时认为是论元角色和具体论元短语的映射
192
+ # 还没有发现doc的作用
193
+ doc = None
194
+ # 通过test_rams.sh文件的设置 可以发现args.head_only的值为true
195
+ # print('aa', args.head_only, args.coref)
196
+ if args.head_only:
197
+ # 从原始文本中取出标记
198
+ doc = nlp(' '.join(context_words))
199
+ # 其中arg_name是论元角色类型
200
+ for argname in predicted_args:
201
+ # 通过find_arg_span函数找出
202
+ arg_span = find_arg_span(predicted_args[argname], context_words,
203
+ trigger_start, trigger_end, head_only=args.head_only, doc=doc)
204
+ #print(arg_span)
205
+ if arg_span:# if None means hullucination
206
+
207
+ if args.head_only and args.coref:
208
+ # consider coreferential mentions as matching
209
+ assert('corefs' in ex)
210
+ print('aaa')
211
+ gold_spans = [a[1] for a in ex['ref_evt_links'] if a[2]==argname]
212
+ arg_span = check_coref(ex, list(arg_span), gold_spans)
213
+
214
+ ex['gold_evt_links'].append([[trigger_start, trigger_end], list(arg_span), argname])
215
+
216
+ writer.write(json.dumps(ex)+'\n')
217
+
218
+ writer.close()
219
+
220
+
221
+
test_rams.sh CHANGED
@@ -5,7 +5,7 @@ CKPT_NAME=gen-RAMS
5
  MODEL=gen
6
 
7
  python train.py --model=$MODEL --ckpt_name=$CKPT_NAME-pred \
8
- --load_ckpt=checkpoints/$CKPT_NAME/epoch=2-v0.ckpt \
9
  --dataset=RAMS \
10
  --eval_only \
11
  --train_file=data/RAMS_1.0/data/train.jsonlines \
@@ -19,15 +19,15 @@ python train.py --model=$MODEL --ckpt_name=$CKPT_NAME-pred \
19
 
20
 
21
  #span eval
22
- #python src/genie/convert_gen_to_output.py --gen-file=checkpoints/$CKPT_NAME-pred/predictions.jsonl \
23
  #--output-file=checkpoints/$CKPT_NAME-pred/span_output.jsonl
24
 
25
  #python data/RAMS_1.0/scorer/scorer.py -g=data/RAMS_1.0/data/test.jsonlines -p=checkpoints/$CKPT_NAME-pred/span_output.jsonl \
26
  #--reuse_gold_format --do_all > checkpoints/$CKPT_NAME-pred/span_metrics.txt
27
 
28
  # head eval
29
- python src/genie/convert_gen_to_output1.py --gen-file=checkpoints/$CKPT_NAME-pred/predictions.jsonl \
30
- --output-file=checkpoints/$CKPT_NAME-pred/output.jsonl --head-only
31
 
32
  python data/RAMS_1.0/scorer/scorer.py -g=data/RAMS_1.0/data/test_head.jsonlines -p=checkpoints/$CKPT_NAME-pred/output.jsonl \
33
  --reuse_gold_format --do_all > checkpoints/$CKPT_NAME-pred/head_metrics.txt
 
5
  MODEL=gen
6
 
7
  python train.py --model=$MODEL --ckpt_name=$CKPT_NAME-pred \
8
+ --load_ckpt=checkpoints/$CKPT_NAME-what-head/epoch=2-v0.ckpt \
9
  --dataset=RAMS \
10
  --eval_only \
11
  --train_file=data/RAMS_1.0/data/train.jsonlines \
 
19
 
20
 
21
  #span eval
22
+ #python src/genie/convert_gen_to_output5.py --gen-file=checkpoints/$CKPT_NAME-pred/predictions.jsonl \
23
  #--output-file=checkpoints/$CKPT_NAME-pred/span_output.jsonl
24
 
25
  #python data/RAMS_1.0/scorer/scorer.py -g=data/RAMS_1.0/data/test.jsonlines -p=checkpoints/$CKPT_NAME-pred/span_output.jsonl \
26
  #--reuse_gold_format --do_all > checkpoints/$CKPT_NAME-pred/span_metrics.txt
27
 
28
  # head eval
29
+ python src/genie/convert_gen_to_output5.py --gen-file=checkpoints/$CKPT_NAME-pred/predictions.jsonl \
30
+ --output-file=checkpoints/$CKPT_NAME-pred/output.jsonl --head-only
31
 
32
  python data/RAMS_1.0/scorer/scorer.py -g=data/RAMS_1.0/data/test_head.jsonlines -p=checkpoints/$CKPT_NAME-pred/output.jsonl \
33
  --reuse_gold_format --do_all > checkpoints/$CKPT_NAME-pred/head_metrics.txt