From 00daf7d4da4aa950b44b8492ded59669b113f061 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Tue, 8 Feb 2022 10:05:17 +0900 Subject: [PATCH] Add new labeling option for sequence labeling --- .../tasks/sequenceLabeling/EntityEditor.vue | 13 +++-- .../projects/_id/sequence-labeling/index.vue | 47 ++++++++++++++++++- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/frontend/components/tasks/sequenceLabeling/EntityEditor.vue b/frontend/components/tasks/sequenceLabeling/EntityEditor.vue index 3f927544..a00e9e92 100644 --- a/frontend/components/tasks/sequenceLabeling/EntityEditor.vue +++ b/frontend/components/tasks/sequenceLabeling/EntityEditor.vue @@ -49,8 +49,6 @@ - + @@ -77,6 +107,7 @@ export default { project: {}, enableAutoLabeling: false, rtl: false, + selectedLabelIndex: null, } }, @@ -101,15 +132,25 @@ export default { shortKeys() { return Object.fromEntries(this.labels.map(item => [item.id, [item.suffixKey]])) }, + projectId() { return this.$route.params.id }, + doc() { if (_.isEmpty(this.docs) || this.docs.items.length === 0) { return {} } else { return this.docs.items[0] } + }, + + selectedLabel() { + if (Number.isInteger(this.selectedLabelIndex)) { + return this.labels[this.selectedLabelIndex] + } else { + return null + } } }, @@ -178,6 +219,10 @@ export default { await this.$services.example.confirm(this.projectId, this.doc.id) await this.$fetch() }, + + changeSelectedLabel(event) { + this.selectedLabelIndex = this.labels.findIndex((item) => item.suffixKey === event.srcKey) + } } }