This commit is contained in:
zyronon
2023-09-26 18:51:26 +08:00
parent 806659ac0f
commit b59d3cb66c
2 changed files with 29 additions and 2 deletions

View File

@@ -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)
})
</script>
<template>
<div id="BatchAddArticle">
<AddArticle2/>
<!-- <AddArticle2/>-->
</div>
</template>

View File

@@ -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)
}