Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathindex.html
More file actions
Latest commit
352 lines (311 loc) · 14.3 KB
/
Copy pathindex.html
File metadata and controls
352 lines (311 loc) · 14.3 KB
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>TAG Demo</title>
<!-- Font Awesome webfont for icons -->
<linkrel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"
integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<!-- Demo-specific styles (fonts, positioning, etc.)
-- The core TAG styles, as well as the Bootstrap/Prism styles used for the UI demo below, are also imported within
-- `demo.scss`.
-->
<linkhref="demo.min.css" rel="stylesheet">
<!-- In particular, we use the Web Font Loader library to ensure that the fonts we are using for the demo are
-- available (so that our width/height calculations for Text elements are accurate)
-->
<scriptsrc="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js"></script>
</head>
<body>
<divclass="container py-5">
<h2class="mb-5">TextAnnotationGraphs (TAG) Demo</h2>
<divclass="row mb-3">
<divclass="col">
<h4>Documentation</h4>
<p>
See the API documentation <ahref="/docs" target="_blank">here</a>.
</p>
</div>
</div>
<divclass="row mb-5">
<divclass="col">
<h4>Basic example</h4>
<p>
For a minimal embedded TAG visualisation, simply specify the container element, the annotation data to load, and
the format that the data is in.
</p>
<p>
See the full source for this example in the "Basic example" section of
<codeclass="bg-light">src/demo.js</code>.
</p>
<preclass="mb-4">
<codeclass="language-javascript">const tag = TAG.tag({
container: "container-id",
data: {...},
format: "odin",
options: {
showTopArgLabels: true
}
});</code></pre>
<divid="basicContainer" style="border: solid 1px lightgray"></div>
</div>
</div>
<divclass="row mb-5">
<divclass="col">
<h4>Extended UI example</h4>
<p>
It is also possible to build a UI around the TAG visualisation using the various API functions.
</p>
<p>
This example uses Bootstrap 4 styles and components. See the source in the "Advanced/UI example" section of
<codeclass="bg-light">src/demo.js</code>.
</p>
<!-- Control buttons -->
<divclass="mb-2">
<!-- Sample dataset loader -->
<divclass="btn-group" id="tag-change-dataset">
<buttontype="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
Load sample dataset
</button>
<divclass="dropdown-menu">
<aclass="dropdown-item tag-dataset" data-path="data/test-brat.ann" data-format="brat" href="#">
Brat format test (test-brat.ann)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/example1.ann" data-format="brat" href="#">
Morphology 1 (example1.ann)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/example2.ann" data-format="brat" href="#">
Morphology 2 (example2.ann)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/example3.ann" data-format="brat" href="#">
Brat event annotations (example3.ann)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/test-odin.json" data-format="odin"
href="#">
Odin format test (test-odin.json)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/sentence-1-odin.json" data-format="odin"
href="#">
Sentence 1 (sentence-1-odin.json)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/sentence-2-odin.json" data-format="odin"
href="#">
Sentence 2 (sentence-2-odin.json)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/sentence-3-odin.json" data-format="odin"
href="#">
Sentence 3 (sentence-3-odin.json)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/paragraph-1-odin.json" data-format="odin"
href="#">
Paragraph (paragraph-1-odin.json)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/passage-1-odin.json" data-format="odin"
href="#">
Passage 1 (passage-1-odin.json)
</a>
<aclass="dropdown-item tag-dataset" data-path="data/passage-2-odin.json" data-format="odin"
href="#">
Passage 2 (passage-2-odin.json)
</a>
</div>
</div>
<!-- Upload button/modal -->
<buttontype="button" class="btn btn-primary" data-toggle="modal" data-target="#tag-upload">
Custom annotation
</button>
<divclass="modal" id="tag-upload" tabindex="-1" role="dialog"
aria-labelledby="upload-title" aria-hidden="true">
<divclass="modal-dialog" role="document">
<divclass="modal-content">
<divclass="modal-header">
<h5class="modal-title" id="upload-title">Custom Annotation</h5>
<buttontype="button" class="close" data-dismiss="modal"
aria-label="Close">
<spanaria-hidden="true">×</span>
</button>
</div>
<divclass="modal-body">
Upload a custom annotation to display:
<divclass="custom-file mt-1">
<inputtype="file" class="custom-file-input" id="tag-upload-input" multiple>
<labelclass="custom-file-label" for="tag-upload-input"
id="tag-upload-label">
Choose file(s)
</label>
</div>
<divclass="d-flex align-items-center mt-3">
<div>Format:</div>
<selectclass="custom-select ml-3" id="tag-upload-format">
<optionvalue="odin">Odin</option>
<optionvalue="brat">Brat</option>
</select>
</div>
</div>
<divclass="modal-footer">
<buttontype="button" id="tag-upload-confirm" class="btn btn-success">
Upload
</button>
</div>
</div>
</div>
</div>
<!-- Options button/modal -->
<buttontype="button" class="btn btn-primary" data-toggle="modal" data-target="#tag-options">
Options
</button>
<divclass="modal" id="tag-options" tabindex="-1" role="dialog"
aria-labelledby="options-title" aria-hidden="true">
<divclass="modal-dialog" role="document">
<divclass="modal-content">
<divclass="modal-header">
<h5class="modal-title" id="options-title">Options</h5>
<buttontype="button" class="close" data-dismiss="modal"
aria-label="Close">
<spanaria-hidden="true">×</span>
</button>
</div>
<divclass="modal-body">
<divclass="px-3">
Show the following types of links above words:
<selectid="tag-option-top-links" class="custom-select mb-2">
<!-- Options will be added at run time in `demo.js` based on the categories available in the
data loaded -->
</select>
Show the following types of links below words:
<selectid="tag-option-bottom-links" class="custom-select mb-3">
<!-- Options will be added at run time in `demo.js` based on the categories available in the
data loaded -->
</select>
Show the following types of tags above words:
<selectid="tag-option-top-tags" class="custom-select mb-2">
<!-- Options will be added at run time in `demo.js` based on the categories available in the
data loaded -->
</select>
Show the following types of tags below words:
<selectid="tag-option-bottom-tags" class="custom-select mb-3">
<!-- Options will be added at run time in `demo.js` based on the categories available in the
data loaded -->
</select>
<divclass="custom-control custom-checkbox">
<inputtype="checkbox" class="custom-control-input" id="tag-option-top-links-on-move">
<labelclass="custom-control-label" for="tag-option-top-links-on-move">
Show top links when moving words
</label>
</div>
<divclass="custom-control custom-checkbox">
<inputtype="checkbox" class="custom-control-input" id="tag-option-bottom-links-on-move">
<labelclass="custom-control-label" for="tag-option-bottom-links-on-move">
Show bottom links when moving words
</label>
</div>
<divclass="custom-control custom-checkbox">
<inputtype="checkbox" class="custom-control-input" id="tag-option-top-main-label">
<labelclass="custom-control-label" for="tag-option-top-main-label">
Show main label on top links
</label>
</div>
<divclass="custom-control custom-checkbox">
<inputtype="checkbox" class="custom-control-input" id="tag-option-top-arg-labels">
<labelclass="custom-control-label" for="tag-option-top-arg-labels">
Show argument labels on top links
</label>
</div>
<divclass="custom-control custom-checkbox mt-3">
<inputtype="checkbox" class="custom-control-input" id="tag-option-bottom-main-label">
<labelclass="custom-control-label" for="tag-option-bottom-main-label">
Show main label on bottom links
</label>
</div>
<divclass="custom-control custom-checkbox">
<inputtype="checkbox" class="custom-control-input" id="tag-option-bottom-arg-labels">
<labelclass="custom-control-label" for="tag-option-bottom-arg-labels">
Show argument labels on bottom links
</label>
</div>
<divclass="custom-control custom-checkbox mt-3">
<inputtype="checkbox" class="custom-control-input" id="tag-option-compact">
<labelclass="custom-control-label" for="tag-option-compact">
Lock rows to the minimum height needed to fit links
</label>
</div>
<divclass="form-group mt-3">
<div>Link slot interval</div>
<divclass="form-row">
<divclass="d-flex">
<divclass="col-auto">
<inputid="tag-option-link-slot" type="text"
title="Link slot interval">
</div>
<divclass="col">
<spanid="tag-option-link-slot-value"></span>
</div>
</div>
</div>
</div>
</div>
</div>
<divclass="modal-footer">
<buttontype="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Download button -->
<buttontype="button" class="btn btn-primary" id="tag-download">Download as SVG</button>
<!-- Taxonomy button/modal -->
<buttontype="button" class="btn btn-primary" data-toggle="modal" data-target="#tag-taxonomy">
Taxonomy/Colours
</button>
<divclass="modal" id="tag-taxonomy" tabindex="-1" role="dialog"
aria-labelledby="taxonomy-title" aria-hidden="true">
<divclass="modal-dialog modal-lg" role="document">
<divclass="modal-content">
<divclass="modal-header">
<h5class="modal-title" id="taxonomy-title">Taxonomy/Colours</h5>
<buttontype="button" class="close" data-dismiss="modal"
aria-label="Close">
<spanaria-hidden="true">×</span>
</button>
</div>
<divclass="modal-body">
<!-- Taxonomy viewer/colour picker -->
<divid="tag-taxonomy-view">
<buttontype="button" class="btn btn-primary" id="tag-taxonomy-start-edit">
Edit taxonomy
</button>
<!-- Will be dynamically generated using a Handlebars template -->
<divclass="card mt-2" id="tag-taxonomy-tree">
</div>
</div>
<!-- On-the-fly editor -->
<divid="tag-taxonomy-edit">
<divid="tag-taxonomy-editor"></div>
<divid="tag-taxonomy-editor-errors" class="invalid-feedback"></div>
<buttontype="button" class="btn btn-primary mt-2" id="tag-taxonomy-stop-edit">
Save
</button>
</div>
</div>
<divclass="modal-footer">
<buttontype="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<divid="uiContainer" style="border: solid 1px lightgray"></div>
</div>
</div>
</div>
<!-- Main demo bundle
-- The Bootstrap/Prism code used for the UI demo is included directly into the bundle.
-->
<scriptsrc="demo.min.js"></script>
<!-- Colour picker script
-- Included directly here because it doesn't play nice with Browserify
-->
<scriptsrc="bootstrap-colorpicker.min.js"></script>
</body>
</html>