From c9fb7916aa48a3981826c390fe7b27b6d1d6dea4 Mon Sep 17 00:00:00 2001 From: maxmon <541182180@qq.com> Date: Mon, 21 Jun 2021 03:26:23 +0800 Subject: [PATCH] =?UTF-8?q?+=20=E8=B0=83=E6=95=B4=E6=A0=87=E6=B3=A8?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BC=A0=E8=BE=93=E7=BB=93=E6=9E=84=EF=BC=8C?= =?UTF-8?q?=E5=8F=96=E6=B6=88json=E8=BD=AC=E4=B9=89=EF=BC=8C=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E5=AF=BC=E5=87=BA=E4=B8=AD=E7=9A=84isSmall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- be/app/projects/demo5/anno.json | 2 +- fe/src/components/NER/index.vue | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) 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))