Skip to content

Commit

Permalink
perf: splitter
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Nov 21, 2024
1 parent e7bde66 commit 23aadd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/global/common/string/textSplitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ const commonSplit = (props: SplitProps): SplitResponse => {
{ reg: /^(#####\s[^\n]+\n)/gm, maxLen: chunkLen * 1.8 },

{ reg: /([\n]([`~]))/g, maxLen: chunkLen * 4 }, // code block
{ reg: /([\n](?!\s*[\*\-|>0-9]))/g, maxLen: chunkLen * 2 }, // 增大块,尽可能保证它是一个完整的段落。 (?![\*\-|>`0-9]): markdown special char
{ reg: /([\n\n])/g, maxLen: chunkLen * 1.6 },
{ reg: /([\n](?=\s*[0-9]+\.))/g, maxLen: chunkLen * 2 }, // 增大块,尽可能保证它是一个完整的段落。 (?![\*\-|>`0-9]): markdown special char
{ reg: /(\n{2,})/g, maxLen: chunkLen * 1.6 },
{ reg: /([\n])/g, maxLen: chunkLen * 1.2 },
// ------ There's no overlap on the top
{ reg: /([。]|([a-zA-Z])\.\s)/g, maxLen: chunkLen * 1.2 },
Expand Down

0 comments on commit 23aadd8

Please sign in to comment.