Browse Source

Update demo script

pull/10/head
Hironsan 6 years ago
parent
commit
90ce7a468b
4 changed files with 11 additions and 4 deletions
  1. 2
      app/server/static/bundle/demo_named_entity.js
  2. 2
      app/server/static/bundle/demo_text_classification.js
  3. 2
      app/server/static/bundle/demo_translation.js
  4. 9
      app/server/static/js/demo/demo_mixin.js

2
app/server/static/bundle/demo_named_entity.js

@ -161,7 +161,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n tmp_docs: [],\n tmp_annotations: [],\n guideline: '',\n searchQuery: '',\n picked: 'all',\n annotationId: 100,\n };\n },\n\n methods: {\n nextPage() {\n this.pageNumber = Math.min(this.pageNumber + 1, this.docs.length - 1);\n },\n\n prevPage() {\n this.pageNumber = Math.max(this.pageNumber - 1, 0);\n },\n\n search() {\n this.docs = [];\n this.annotations = [];\n for (let i = 0; i < this.tmp_docs.length; i++) {\n if (this.tmp_docs[i].text.indexOf(this.searchQuery) !== -1) {\n if (this.picked === 'all') {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n if (this.picked === 'active') {\n if (this.tmp_annotations[i].length === 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n if (this.picked === 'completed') {\n if (this.tmp_annotations[i].length !== 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n }\n }\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n submit() {\n this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n },\n\n created() {\n this.tmp_docs = this.docs;\n this.tmp_annotations = this.annotations;\n },\n\n computed: {\n total() {\n return this.tmp_docs.length;\n },\n\n count() {\n return this.docs.length;\n },\n\n remaining() {\n let cnt = 0;\n for (let i = 0; i < this.tmp_annotations.length; i++) {\n if (this.tmp_annotations[i].length === 0) {\n cnt += 1;\n }\n }\n return cnt;\n },\n\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/demo/demo_mixin.js?");
eval("__webpack_require__.r(__webpack_exports__);\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n tmp_docs: [],\n tmp_annotations: [],\n guideline: 'You can see annotation guideline here.',\n searchQuery: '',\n picked: 'all',\n annotationId: 100,\n isActive: false,\n };\n },\n\n methods: {\n nextPage() {\n this.pageNumber = Math.min(this.pageNumber + 1, this.docs.length - 1);\n },\n\n prevPage() {\n this.pageNumber = Math.max(this.pageNumber - 1, 0);\n },\n\n search() {\n this.docs = [];\n this.annotations = [];\n for (let i = 0; i < this.tmp_docs.length; i++) {\n if (this.tmp_docs[i].text.indexOf(this.searchQuery) !== -1) {\n if (this.picked === 'all') {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n if (this.picked === 'active') {\n if (this.tmp_annotations[i].length === 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n if (this.picked === 'completed') {\n if (this.tmp_annotations[i].length !== 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n }\n }\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n submit() {\n this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n },\n\n created() {\n this.tmp_docs = this.docs;\n this.tmp_annotations = this.annotations;\n },\n\n computed: {\n total() {\n return this.tmp_docs.length;\n },\n\n count() {\n return this.docs.length;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n remaining() {\n let cnt = 0;\n for (let i = 0; i < this.tmp_annotations.length; i++) {\n if (this.tmp_annotations[i].length === 0) {\n cnt += 1;\n }\n }\n return cnt;\n },\n\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/demo/demo_mixin.js?");
/***/ }),

2
app/server/static/bundle/demo_text_classification.js

@ -161,7 +161,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n tmp_docs: [],\n tmp_annotations: [],\n guideline: '',\n searchQuery: '',\n picked: 'all',\n annotationId: 100,\n };\n },\n\n methods: {\n nextPage() {\n this.pageNumber = Math.min(this.pageNumber + 1, this.docs.length - 1);\n },\n\n prevPage() {\n this.pageNumber = Math.max(this.pageNumber - 1, 0);\n },\n\n search() {\n this.docs = [];\n this.annotations = [];\n for (let i = 0; i < this.tmp_docs.length; i++) {\n if (this.tmp_docs[i].text.indexOf(this.searchQuery) !== -1) {\n if (this.picked === 'all') {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n if (this.picked === 'active') {\n if (this.tmp_annotations[i].length === 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n if (this.picked === 'completed') {\n if (this.tmp_annotations[i].length !== 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n }\n }\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n submit() {\n this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n },\n\n created() {\n this.tmp_docs = this.docs;\n this.tmp_annotations = this.annotations;\n },\n\n computed: {\n total() {\n return this.tmp_docs.length;\n },\n\n count() {\n return this.docs.length;\n },\n\n remaining() {\n let cnt = 0;\n for (let i = 0; i < this.tmp_annotations.length; i++) {\n if (this.tmp_annotations[i].length === 0) {\n cnt += 1;\n }\n }\n return cnt;\n },\n\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/demo/demo_mixin.js?");
eval("__webpack_require__.r(__webpack_exports__);\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n tmp_docs: [],\n tmp_annotations: [],\n guideline: 'You can see annotation guideline here.',\n searchQuery: '',\n picked: 'all',\n annotationId: 100,\n isActive: false,\n };\n },\n\n methods: {\n nextPage() {\n this.pageNumber = Math.min(this.pageNumber + 1, this.docs.length - 1);\n },\n\n prevPage() {\n this.pageNumber = Math.max(this.pageNumber - 1, 0);\n },\n\n search() {\n this.docs = [];\n this.annotations = [];\n for (let i = 0; i < this.tmp_docs.length; i++) {\n if (this.tmp_docs[i].text.indexOf(this.searchQuery) !== -1) {\n if (this.picked === 'all') {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n if (this.picked === 'active') {\n if (this.tmp_annotations[i].length === 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n if (this.picked === 'completed') {\n if (this.tmp_annotations[i].length !== 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n }\n }\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n submit() {\n this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n },\n\n created() {\n this.tmp_docs = this.docs;\n this.tmp_annotations = this.annotations;\n },\n\n computed: {\n total() {\n return this.tmp_docs.length;\n },\n\n count() {\n return this.docs.length;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n remaining() {\n let cnt = 0;\n for (let i = 0; i < this.tmp_annotations.length; i++) {\n if (this.tmp_annotations[i].length === 0) {\n cnt += 1;\n }\n }\n return cnt;\n },\n\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/demo/demo_mixin.js?");
/***/ }),

2
app/server/static/bundle/demo_translation.js

@ -161,7 +161,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n tmp_docs: [],\n tmp_annotations: [],\n guideline: '',\n searchQuery: '',\n picked: 'all',\n annotationId: 100,\n };\n },\n\n methods: {\n nextPage() {\n this.pageNumber = Math.min(this.pageNumber + 1, this.docs.length - 1);\n },\n\n prevPage() {\n this.pageNumber = Math.max(this.pageNumber - 1, 0);\n },\n\n search() {\n this.docs = [];\n this.annotations = [];\n for (let i = 0; i < this.tmp_docs.length; i++) {\n if (this.tmp_docs[i].text.indexOf(this.searchQuery) !== -1) {\n if (this.picked === 'all') {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n if (this.picked === 'active') {\n if (this.tmp_annotations[i].length === 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n if (this.picked === 'completed') {\n if (this.tmp_annotations[i].length !== 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n }\n }\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n submit() {\n this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n },\n\n created() {\n this.tmp_docs = this.docs;\n this.tmp_annotations = this.annotations;\n },\n\n computed: {\n total() {\n return this.tmp_docs.length;\n },\n\n count() {\n return this.docs.length;\n },\n\n remaining() {\n let cnt = 0;\n for (let i = 0; i < this.tmp_annotations.length; i++) {\n if (this.tmp_annotations[i].length === 0) {\n cnt += 1;\n }\n }\n return cnt;\n },\n\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/demo/demo_mixin.js?");
eval("__webpack_require__.r(__webpack_exports__);\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n tmp_docs: [],\n tmp_annotations: [],\n guideline: 'You can see annotation guideline here.',\n searchQuery: '',\n picked: 'all',\n annotationId: 100,\n isActive: false,\n };\n },\n\n methods: {\n nextPage() {\n this.pageNumber = Math.min(this.pageNumber + 1, this.docs.length - 1);\n },\n\n prevPage() {\n this.pageNumber = Math.max(this.pageNumber - 1, 0);\n },\n\n search() {\n this.docs = [];\n this.annotations = [];\n for (let i = 0; i < this.tmp_docs.length; i++) {\n if (this.tmp_docs[i].text.indexOf(this.searchQuery) !== -1) {\n if (this.picked === 'all') {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n if (this.picked === 'active') {\n if (this.tmp_annotations[i].length === 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n if (this.picked === 'completed') {\n if (this.tmp_annotations[i].length !== 0) {\n this.docs.push(this.tmp_docs[i]);\n this.annotations.push(this.tmp_annotations[i]);\n }\n }\n }\n }\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n submit() {\n this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n },\n\n created() {\n this.tmp_docs = this.docs;\n this.tmp_annotations = this.annotations;\n },\n\n computed: {\n total() {\n return this.tmp_docs.length;\n },\n\n count() {\n return this.docs.length;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n remaining() {\n let cnt = 0;\n for (let i = 0; i < this.tmp_annotations.length; i++) {\n if (this.tmp_annotations[i].length === 0) {\n cnt += 1;\n }\n }\n return cnt;\n },\n\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/demo/demo_mixin.js?");
/***/ }),

9
app/server/static/js/demo/demo_mixin.js

@ -7,10 +7,11 @@ const annotationMixin = {
labels: [],
tmp_docs: [],
tmp_annotations: [],
guideline: '',
guideline: 'You can see annotation guideline here.',
searchQuery: '',
picked: 'all',
annotationId: 100,
isActive: false,
};
},
@ -89,6 +90,12 @@ const annotationMixin = {
return this.docs.length;
},
compiledMarkdown() {
return marked(this.guideline, {
sanitize: true,
});
},
remaining() {
let cnt = 0;
for (let i = 0; i < this.tmp_annotations.length; i++) {

Loading…
Cancel
Save