Spaces:
Sleeping
Sleeping
Download src/chunking/overlap_manager.py from manhhung211/Rag_Production: direct link, hf CLI and curl.
- Browser
- Download file 855 Bytes
-
https://huggingface.co/spaces/manhhung211/Rag_Production/resolve/main/src/chunking/overlap_manager.py
- Command line
-
hf download hf://spaces/manhhung211/Rag_Production/src/chunking/overlap_manager.py
-
curl -L -o overlap_manager.py https://huggingface.co/spaces/manhhung211/Rag_Production/resolve/main/src/chunking/overlap_manager.py
855 Bytes
| """ | |
| src/chunking/overlap_manager.py | |
| Manages overlap strategy between chunks to preserve context continuity. | |
| Placeholder — implement custom overlap logic here if the default | |
| RecursiveCharacterTextSplitter overlap is insufficient. | |
| """ | |
| class OverlapManager: | |
| """ | |
| Controls how much context bleeds over between adjacent chunks. | |
| TODO: Implement custom overlap strategies such as: | |
| - Sentence-boundary-aware overlap | |
| - Sliding window with adaptive overlap | |
| - Semantic overlap (carry over most relevant sentences) | |
| """ | |
| def __init__(self, overlap_size: int = 100): | |
| self.overlap_size = overlap_size | |
| def apply(self, chunks: list) -> list: | |
| """Apply overlap strategy to a list of chunk strings. (Placeholder)""" | |
| # Default: no additional processing beyond what the splitter does. | |
| return chunks | |