-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconstant.py
63 lines (53 loc) · 1.7 KB
/
constant.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*- coding: utf-8 -*-
# @Author: gunjianpan
# @Date: 2019-03-28 13:01:21
# @Last Modified by: gunjianpan
# @Last Modified time: 2019-03-28 16:30:20
test_data_path = 'data/test/'
train_data_path = 'data/'
prediction_path = 'prediction/'
score_script_path = 'data/semeval2018_task7_scorer-v1.2.pl'
pickle_path = 'pickle/' # embedding.
embedding_dir = '../LightRel//SemEval18task7/feature/'
version = '1.1'
imbalance = 'train'
train_str = ''
test_str = '.test'
key_str = 'keys{}.'.format(test_str)
data_txt_path = '.relations.txt'
xml_path = '.text.xml'
common_path = '%s%s%s%s'
train_data_xml = common_path % (train_data_path, version, train_str, xml_path)
train_data_txt = common_path % (
train_data_path, version, train_str, data_txt_path)
test_data_xml = common_path % (test_data_path, version, test_str, xml_path)
test_data_txt = common_path % (
test_data_path, version, test_str, data_txt_path)
test_data_key = common_path % (test_data_path, key_str, version, '.txt')
embedding_dim = 300
rela2id = {
'USAGE': 0,
'TOPIC': 1,
'RESULT': 2,
'PART_WHOLE': 3,
'MODEL-FEATURE': 4,
'COMPARE': 5
}
id2rela = {
0: 'USAGE',
1: 'TOPIC',
2: 'RESULT',
3: 'PART_WHOLE',
4: 'MODEL-FEATURE', # MODEL
5: 'COMPARE' # COMPARISON
}
entity_relation = {
0: ['used by', 'used for', 'applied to', 'performed on'], # USAGE
1: ['presents', 'of'], # TOPIC
2: ['affects', 'problem', 'yields'], # RESULT
3: ['composed of', 'extracted from', 'found in'], # PART_WHOLE
4: ['of an observed', 'of', 'associated to'], # MODEL-FEATURE (MODEL)
5: ['compared to'], # COMPARE (COMPARISON)
}
def key_path(key=1):
return '%skeys.test.1.%d.txt' % (test_data_path, key)