-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabels.py
133 lines (108 loc) · 3.54 KB
/
labels.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# A) CONFIG KEYS
SEED = 'general-seed'
KEYWORDS_FILTERED_APPROACH = 'keywords-filtered-approach'
BERT_MODEL_NAME = 'bert-model-name'
LABEL_SET = 'label-set'
LABEL_NUMBER = 'label-number'
NUM_LABELS = 'num-labels'
TOKEN_CLASSIFIER = 'token-classifier'
SAME_GATEWAY_CLASSIFIER = 'same-gateway-classifier'
ACTIVITY_RELATION_CLASSIFIER = 'activity-relation-classifier'
CONTEXT_LABEL_LENGTH = 'context-label-length'
SYNONYM_SAMPLES_START_NUMBER = 'synonym-samples-start-number'
EVENTUALLY_FOLLOWS_SAMPLE_LIMIT = 'eventually-follows-sample-limit'
MAX_LENGTH_RELATION_TEXT = 'max-length-relation-text'
ES_PATIENCE = 'es-patience'
MODELS = 'final-models'
# B) LABELS FOR RULE APPROACH
# available sets of keywords and contradictory keywords
LITERATURE = 'literature' # only keyword
LITERATURE_FILTERED = 'literature_filtered' # only keyword
GOLD = 'gold'
CUSTOM = 'own'
# output formats
PET = 'pet'
BENCHMARK = 'benchmark'
# for handling surrounding activities
ELEMENT = 'element'
SOURCE = 'source'
TARGET = 'target'
# gateway frame keys for merging sequence flows
START_SENTENCE_IDX = 'start_sentence_idx'
START_TOKEN_ID = 'start_token_idx'
START_ENTITY = 'start_entity'
END_SENTENCE_IDX = 'end_sentence_idx'
END_TOKEN_ID = 'end_token_idx'
END_ENTITY = 'end_entity'
# C) LABELS FOR TOKEN CLASSIFICATION TASK
# label sets
ALL = 'all'
FILTERED = 'filtered'
# classification labels
TC_LABEL_OUT_OF_SCOPE = 0
TC_LABEL_OTHER = 1 # in case of 'filtered' labels -> all the rest; in case of 'all' labels -> 'O'
TC_LABEL_XOR = 2
TC_LABEL_AND = 3
TC_LABEL_ACTIVITY = 4
TC_LABEL_ACTIVITY_DATA = 5
TC_LABEL_ACTOR = 6
TC_LABEL_FURTHER_SPECIFICATION = 7
TC_LABEL_CONDITION_SPECIFICATION = 8
TC_LABELS_FILTERED = [TC_LABEL_OUT_OF_SCOPE, TC_LABEL_OTHER, TC_LABEL_XOR, TC_LABEL_AND]
TC_LABELS_ALL = [TC_LABEL_OUT_OF_SCOPE, TC_LABEL_OTHER, TC_LABEL_XOR, TC_LABEL_AND, TC_LABEL_ACTIVITY,
TC_LABEL_ACTIVITY_DATA, TC_LABEL_ACTOR, TC_LABEL_FURTHER_SPECIFICATION,
TC_LABEL_CONDITION_SPECIFICATION]
# weights for token classification task
TC_WEIGHTS_BERT_TOKENS = 0
TC_WEIGHTS_GATEWAY_LABELS = 1
# Modes of how to handle differences in token predictions from GatewayTokenClassifier in KeywordsFilterApproach
LOG = 'log'
DROP = 'drop'
# Log levels of filtering
FILE = 'file'
CONSOLE = 'console'
# Sampling strategies
NORMAL = 'normal'
UP_SAMPLING = 'up'
DOWN_SAMPLING = 'down'
ONLY_GATEWAYS = 'og'
# Variants how to include activity data
NOT = 'not'
DUMMY = 'dummy'
SINGLE_MASK = 'single_mask'
MULTI_MASK = 'multi_mask'
# C) LABELS FOR SAME GATEWAY CLASSIFICATION TASK
N_GRAM = 'n_gram'
CONTEXT_NGRAM = 'context_n_gram'
CONTEXT_INDEX = 'context_index'
CONTEXT_LABELS_NGRAM = 'context_labels_n_gram'
CONTEXT_TEXT_AND_LABELS_NGRAM = 'context_text_and_labels_n_gram'
SGC_CONTEXT_LABEL_PADDING = 0
SGC_CONTEXT_LABEL_OTHER = 1
SGC_CONTEXT_LABEL_ACTIVITY = 2
# D) LABELS FOR ACTIVITY RELATION APPROACHES
# relation types
DIRECTLY_FOLLOWING = 'directly_following'
EVENTUALLY_FOLLOWING = 'eventually_following'
EXCLUSIVE = 'exclusive'
CONCURRENT = 'concurrent'
AR_LABEL_DIRECTLY_FOLLOWING = 0
AR_LABEL_EVENTUALLY_FOLLOWING = 1
AR_LABEL_EXCLUSIVE = 2
AR_LABEL_CONCURRENT = 3
# other helper keys
DOC_START = 'Document Start'
DOC_NAME = 'doc_name'
ACTIVITY_1 = 'activity_1'
ACTIVITY_2 = 'activity_2'
RELATION_TYPE = 'relation_type'
COMMENT = 'comment'
# Gateway extraction
SPLIT = 'split'
MERGE = 'merge'
XOR_GATEWAY_OPT = 'XOR Gateway (optional)'
NO_GATEWAY_RELATIONS = 'no_gateway_relations'
# Architecture variants
ARCHITECTURE_CUSTOM = 'custom'
ARCHITECTURE_CNN = 'cnn'
ARCHITECTURE_BRCNN = 'brcnn'