forked from aribornstein/CoRefi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
54 lines (43 loc) · 2.24 KB
/
index.html
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
<!-- You must include this JavaScript file -->
<script src="https://assets.crowd.aws/crowd-html-elements.js"></script>
<script src="https://unpkg.com/vue"></script>
<script src="https://github.com/aribornstein/CoRefi/releases/download/1.1/co-refi.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Material+Icons"
rel="stylesheet">
<!-- For the full list of available Crowd HTML Elements and their input/output documentation,
please refer to https://docs.aws.amazon.com/sagemaker/latest/dg/sms-ui-template-reference.html -->
<!-- You must include crowd-form so that your task submits answers to MTurk -->
<crowd-form answer-format="flatten-objects" answer-format="flatten-objects">
<div data-app>
<co-refi json="${data}"></co-refi>
</div>
<crowd-input id="result" name="result" style="display: none;"></crowd-input>
</crowd-form>
<script>
import jsonData from "./data/sentiment_examples.json" //"../../coref-hypernym/data/scirex2/135.json" //"./data/sentiment_examples.json" //"./data/scirex_example_.json";
let coRefi = document.getElementsByTagName("co-refi")[0].vueComponent;
document.querySelector('crowd-form').onsubmit = function (){
let resultFeild = document.getElementById("result");
let results = {tokens:coRefi.tokens, mentions:coRefi.mentions}
result.value = JSON.stringify(results);
}
function disableSubmit(){
window.setInterval(isHITComplete, 200); // disables the submit key until hit is complete it is hacky but works
}
function isHITComplete() {
let crowdButton = document.getElementsByTagName("crowd-button")[0];
// if all clusterIds assigned then show submit button
if (coRefi){
if (coRefi.mentionsViewed == coRefi.mentions.length-1) {
crowdButton.style.display = "block";
} else {
// console.log((coRefi.mentionsViewed,coRefi.mentions.length));
crowdButton.style.display = "none";
}
}
}
window.onload = disableSubmit;
</script>