-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconstants.py
221 lines (200 loc) · 6.08 KB
/
constants.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Global Constants
@author: Hrishikesh Terdalkar
"""
###############################################################################
# Roles
ROLE_OWNER = "owner"
ROLE_ADMIN = "admin"
ROLE_CURATOR = "curator"
ROLE_ANNOTATOR = "annotator"
ROLE_MEMBER = "member"
ROLE_GUEST = "guest"
# --------------------------------------------------------------------------- #
# Permissions
PERMISSION_VIEW_UCP = "view_ucp"
PERMISSION_VIEW_CORPUS = "view_corpus"
PERMISSION_ANNOTATE = "annotate"
PERMISSION_CURATE = "curate"
PERMISSION_VIEW_ACP = "view_acp"
# --------------------------------------------------------------------------- #
# Role Definitions
ROLE_DEFINITIONS = [
{
"name": ROLE_GUEST,
"level": 1,
"description": "Guest",
"permissions": []
},
{
"name": ROLE_MEMBER,
"level": 5,
"description": "Member",
"permissions": [PERMISSION_VIEW_UCP, PERMISSION_VIEW_CORPUS]
},
{
"name": ROLE_ANNOTATOR,
"level": 50,
"description": "Annotator",
"permissions": [PERMISSION_ANNOTATE],
},
{
"name": ROLE_CURATOR,
"level": 75,
"description": "Curator",
"permissions": [PERMISSION_ANNOTATE, PERMISSION_CURATE]
},
{
"name": ROLE_ADMIN,
"level": 100,
"description": "Administrator",
"permissions": [PERMISSION_VIEW_ACP]
},
{
"name": ROLE_OWNER,
"level": 1000,
"description": "Owner",
"permissions": [PERMISSION_VIEW_ACP]
},
]
###############################################################################
# Default Annotation User Details
AUTO_ANNOTATION_USER_ID = 0
AUTO_ANNOTATION_USER_USERNAME = "auto"
AUTO_ANNOTATION_USER_EMAIL = "auto"
AUTO_ANNOTATION_USER_PASS = "auto"
###############################################################################
# Task Categories
TASK_SENTENCE_BOUNDARY = "sentence_boundary"
TASK_WORD_ORDER = "word_order"
TASK_TOKEN_TEXT_ANNOTATION = "token_text_annotation"
TASK_TOKEN_CLASSIFICATION = "token_classification"
TASK_TOKEN_GRAPH = "token_graph"
TASK_TOKEN_CONNECTION = "token_connection"
TASK_SENTENCE_CLASSIFICATION = "sentence_classification"
TASK_SENTENCE_GRAPH = "sentence_graph"
TASK_CATEGORY_LIST = [
TASK_SENTENCE_BOUNDARY,
TASK_WORD_ORDER,
TASK_TOKEN_TEXT_ANNOTATION,
TASK_TOKEN_CLASSIFICATION,
TASK_TOKEN_GRAPH,
TASK_TOKEN_CONNECTION,
TASK_SENTENCE_CLASSIFICATION,
TASK_SENTENCE_GRAPH
]
###############################################################################
TASK_TEMPLATE_PREFIX = "task"
RESULT_TEMPLATE_PREFIX = "result"
TASK_UPDATE_ACTION_PREFIX = "update"
TASK_ANNOTATION_TEMPLATES = {
category: f"{TASK_TEMPLATE_PREFIX}_{category}.html"
for category in TASK_CATEGORY_LIST
}
TASK_EXPORT_TEMPLATES = {
category: f"{RESULT_TEMPLATE_PREFIX}_{category}.html"
for category in TASK_CATEGORY_LIST
}
TASK_UPDATE_ACTIONS = {
category: f"{TASK_UPDATE_ACTION_PREFIX}_{category}"
for category in TASK_CATEGORY_LIST
}
###############################################################################
TASK_DEFAULT_INFORMATION = {
TASK_SENTENCE_BOUNDARY: {
"category": "sentence_boundary",
"title": "Sentence Boundary Detection",
"short": "Boundary",
"help": "Mark the sentence boundary using the boundary marker."
},
TASK_WORD_ORDER: {
"category": "word_order",
"title": "Token Order",
"short": "Token Order",
"help": (
"Arrange the tokens in the required order. Optionally, "
"add new tokens or exclude existing tokens from the sentence."
)
},
TASK_TOKEN_TEXT_ANNOTATION: {
"category": "token_text_annotation",
"title": "Token Text Annotation",
"short": "TextAnno",
"help": "Enter text annotations associated with the tokens."
},
TASK_TOKEN_CLASSIFICATION: {
"category": "token_classification",
"title": "Token Classification",
"short": "TokClf",
"help": (
"Classify tokens "
"by selecting the correct category from the dropdown menu."
)
},
TASK_TOKEN_GRAPH: {
"category": "token_graph",
"title": "Token Graph",
"short": "TokGraph",
"help": (
"Create an edge-labelled graph on tokens "
"in the form of triplets."
)
},
TASK_TOKEN_CONNECTION: {
"category": "token_connection",
"title": "Token Connection",
"short": "TokConn",
"help": (
"Mark the token connections. "
"First click on the source token and then on the target token, "
"followed by confirming the connection."
)
},
TASK_SENTENCE_CLASSIFICATION: {
"category": "sentence_classification",
"title": "Sentence Classification",
"short": "SentClass",
"help": (
"Classify sentences "
"by selecting the correct category from the dropdown menu."
)
},
TASK_SENTENCE_GRAPH: {
"category": "sentence_graph",
"title": "Sentence Graph",
"short": "SentGraph",
"help": (
"Create an edge-labelled graph on sentences "
"in the form of tripelts. "
"Sentences can be connected through the "
"constituent tokens or directly."
"Direct connections are marked using "
"the special tokens that appear at the start of the sentence."
)
}
}
###############################################################################
# File Type
FILE_TYPE_JSON = {
"value": "json",
"description": "JSON",
"extensions": ["json"]
}
FILE_TYPE_CSV = {
"value": "csv",
"description": "CSV",
"extensions": ["csv"]
}
FILE_TYPE_CONLLU = {
"value": "conllu",
"description": "CoNLL-U",
"extensions": ["conllu", "txt"]
}
FILE_TYPE_PLAINTEXT = {
"value": "plaintext",
"description": "Plain Text",
"extensions": ["txt"]
}
###############################################################################