This commit is contained in:
Archer
2023-09-26 14:31:37 +08:00
committed by GitHub
parent 38d4db5d5f
commit f6552d0d4f
48 changed files with 536 additions and 399 deletions

View File

@@ -11,7 +11,7 @@ export const splitText2Chunks = ({ text, maxLen }: { text: string; maxLen: numbe
const overlapLen = Math.floor(maxLen * 0.25); // Overlap length
try {
const splitTexts = text.split(/(?<=[。!?;.!?;])/g);
const splitTexts = text.split(/(?<=[。!?;.!?;\n])/g);
const chunks: string[] = [];
let preChunk = '';