diff --git a/src/components/Add/BatchAddArticle.vue b/src/components/Add/BatchAddArticle.vue index ed2b8c08..d13cc0ac 100644 --- a/src/components/Add/BatchAddArticle.vue +++ b/src/components/Add/BatchAddArticle.vue @@ -4,6 +4,8 @@ import AddArticle2 from "@/components/Add/AddArticle2.vue"; import {$ref} from "vue/macros"; import {cloneDeep} from "lodash-es"; import {DefaultArticle} from "@/types.ts"; +import {onMounted, watch} from "vue"; +import {splitEnArticle2} from "@/hooks/article.ts"; const base = useBaseStore() @@ -14,11 +16,17 @@ let articleData = $ref({ wordIndex: 0, stringIndex: 0, }) + +onMounted(()=>{ + setTimeout(()=>{ + splitEnArticle2(base.currentEditDict.articles[2].text) + },100) +}) diff --git a/src/hooks/article.ts b/src/hooks/article.ts index 6bee3232..5344a13d 100644 --- a/src/hooks/article.ts +++ b/src/hooks/article.ts @@ -344,5 +344,24 @@ export function getSplitTranslateText(article: string) { } export function splitEnArticle2(text: string) { - + //去除头和尾部的空格 + text = text.trim() + // text = text.replaceAll(`‘`, '"') + // text = text.replaceAll(`’`, '"') + // text = text.replaceAll(`“`, '"') + // text = text.replaceAll(`”`, '"') + // 替换所有单引号为双引号 + // text = text.replaceAll(`'`, '"') + // 将缩写词的双引号替换回单引号 + // text = text.replaceAll(`"t`, `'t`) + // text = text.replaceAll(`"s`, `'s`) + // text = text.replaceAll(`"S`, `'S`) + // text = text.replaceAll(`"m`, `'m`) + // text = text.replaceAll(`"d`, `'d`) + // text = text.replaceAll(`"ve`, `'ve`) + // text = text.replaceAll(`"clock`, `'clock`) + console.log('splitEnArticle', text) + let sections = text.split('\n'); + let sentences = text + console.log('sections',sections) }