diff --git a/be/app/projects/demo5/anno.json b/be/app/projects/demo5/anno.json index 8030a6f..713e8e7 100644 --- a/be/app/projects/demo5/anno.json +++ b/be/app/projects/demo5/anno.json @@ -1 +1 @@ -[{"fileName": "", "annoDetails": "[]", "isAnno": true}, {"fileName": "test2.txt", "annoDetails": "[]", "isAnno": true}, {"fileName": "test4.txt", "annoDetails": "[]", "isAnno": true}, {"fileName": "test1.txt", "annoDetails": "[]", "isAnno": true}, {"fileName": "test10.txt", "annoDetails": "[{\"name\":\"小明\",\"type\":\"person1\",\"start\":0,\"end\":2}]", "isAnno": true}] \ No newline at end of file +[{"fileName": "test1.txt", "annoDetails": [], "isAnno": true}, {"fileName": "test10.txt", "annoDetails": [{"name": "小明", "type": "person1", "start": 0, "end": 2, "isSmall": false}, {"name": "北京工业大学", "type": "organiztion", "start": 5, "end": 11}, {"name": "北京", "type": "location", "start": 5, "end": 7, "isSmall": false}], "isAnno": true}] \ No newline at end of file diff --git a/fe/src/components/NER/index.vue b/fe/src/components/NER/index.vue index ca6a996..a265f33 100644 --- a/fe/src/components/NER/index.vue +++ b/fe/src/components/NER/index.vue @@ -268,7 +268,7 @@ export default { post('/v1/anno/create', { projectName: that.projectName, fileName: that.nowFile, - annoDetails: JSON.stringify(that.ners) + annoDetails: that.ners }) that.$set(that.nersCache, that.nowFile, [...that.ners]) return true @@ -292,7 +292,7 @@ export default { delete window.isLoadingNowText // 如果本地没有缓存,就用线上的标注记录 if (!hasCache && info.annoDetails) { - that.$set(that, 'ners', JSON.parse(info.annoDetails)) + that.$set(that, 'ners', info.annoDetails) that.$set(that.nersCache, that.nowFile, [...that.ners]) that.flushWordsType() } @@ -514,7 +514,10 @@ export default { for (const fileName in this.nersCache) { const file = fileName const text = this.textDic[fileName] - const entity = this.nersCache[fileName] + const entity = JSON.parse(JSON.stringify(this.nersCache[fileName])) + entity.map((item) => { + delete item.isSmall; + }) out.push({ file, text, entity }) } this.saveTxt(`${Date.now()}.json`, JSON.stringify(out))