From 2d2941284afc89accddd379c3e5d99f2d00a792f Mon Sep 17 00:00:00 2001 From: khansadaoudi Date: Wed, 7 Aug 2024 13:59:22 +0200 Subject: [PATCH] fix the merge of undefined metadata --- src/components/sentence/SentenceSegmentation.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/sentence/SentenceSegmentation.vue b/src/components/sentence/SentenceSegmentation.vue index c6625e96..4a221a9d 100644 --- a/src/components/sentence/SentenceSegmentation.vue +++ b/src/components/sentence/SentenceSegmentation.vue @@ -486,12 +486,14 @@ export default defineComponent({ mergedSentence.metaJson = { ...firstSentenceJson.metaJson, ...secondSentenceJson.metaJson, - text: firstSentenceJson.metaJson.text + ' ' + secondSentenceJson.metaJson.text, - text_en: firstSentenceJson.metaJson.text_en + ' ' + secondSentenceJson.metaJson.text_en, - phonetic_text: firstSentenceJson.metaJson.phonetic_text + ' ' + secondSentenceJson.metaJson.phonetic_text, timestamp: firstSentenceJson.metaJson.timestamp > secondSentenceJson.metaJson.timestamp ? firstSentenceJson.metaJson.timestamp: secondSentenceJson.metaJson.timestamp, sent_id: this.proposeMergedSentId(firstSentenceJson.metaJson.sent_id as string, secondSentenceJson.metaJson.sent_id as string), }; + for (const key of Object.keys(firstSentenceJson.metaJson).filter(key => key.includes('text'))) { + if (Object.keys(secondSentenceJson.metaJson).includes(key)) { + mergedSentence.metaJson[key] = `${firstSentenceJson.metaJson[key]} ${secondSentenceJson.metaJson[key]}` + } + } return mergedSentence; }, proposeMergedSentId(firstSentId: string, secondSentId: string) {