[BUG] Markdown Text Splitter - Overlap does not work
Describe the bug
I've created a document store and create 4 file loaders using always the same md file
I've used 4 different configuration of splitter type, and chunk size and overlap. Following images shows the outcome of tests
Here seems to exist an issue (Markdown Text Splitter)
Testing using Recursive Character Text Splitter, shows the overlap - chunk size: 1000, overlap 400
To Reproduce
- Create a document store
- Create a document loader of text type
- Upload this md file jack_russell_guide_5pages.md
- Select chunk size: 1000, chunk overlap: 200
- Process
- Wait till document store status will be sync
- Access the view chunks option for the document loader just created.
No overlap seems to exists between chunks
Expected behavior
Overlaps are present, like happens when using Recursive Character Text Splitter
Screenshots
No response
Flow
No response
Use Method
None
Flowise Version
No response
Operating System
None
Browser
None
Additional context
No response
Hi can you verify please?
thanks
Hi can you verify please?
thanks
Yep got the issue, working on it!!
great!
Hi can you fix it please?
any news about this issue?
any news about this issue?
why not just use recursive text splitter?
@HenryHengZJ I've use the recursive text splitter but thi is not the point.
The bug exists, then you have several options A- fix it B- remove this kind of splitter because it have a bug
but IMHO you can not ignore this does not work as expected
It's clear that simplest approach is B, then please follow it
Regards
Any news?
any news?
any news?
any news?
The problem is that if you choose to split after markdown headers, the MarkDownTextSpliter does not any split after chars or overlap. In SplitByHeaders, sections are splited after the headers and no other split is applyed. if you put split by headers by disable, the MarkdownTextSpliter behaves as a simple RecursiveCharSpliter. But, even spliting by headers does not work as expected, because you have headers like === and ---- (h1, h2) which are not splited by MarkdownTextSpliter. Spliting such headers requires some work, because this is not a simple split. In its actual form, the MarkdownTextSpliter can be replaced with a recursiveCharacterTextSpliter with custom separators like: ["\n# ","\n## ","\n### ","\n#### ","\n##### ","\n###### ","\n\n","\n","\ ",""]
Thanks for your help. Then solution is disable split by headers? But what effect this will have in the RAG?
thanks again
Answer/supprot from the flowise team?
The solution is to avoid MarkdownTextSpliter at all it is useless. Instead you can use RecursiveCharacterTextSpliter with custom separators like: ["\n# ","\n## ","\n### ","\n#### ","\n##### ","\n###### ","\n\n","\n"," ",""]. It splits text by the markdown headers and also uses overlap as expected. But pay attention that overlap is used only if the text is split in the middle. Otherwise, if the spliter can split text by separators, it apply no overlap, because it thinks that the separators separate text in semantic chunks. So, if you say you want chunks of 1000 chars with an overlap of 200 chars, if the spliter can do an 800 chunk, spliting by \n##, for example, it will do no overlap, because it will think that the separator splits text in semantic ways. The overlap is there only to keep semantic context when text is split in the middle of a phrase, proposition, or so. So, in conclusion, forget about markdowntextspliter, it is a joke.
Ok, I trust your asnwer and advise, but is this is the situation my expectation is the FLOWISE team put a note in documentation.
Thanks a lot
then flowise team? this is the quality of your Best Effort Support?