Rag_Production / src /chunking /overlap_manager.py
mhungtr211
Deploy bản RAG sạch lên Hugging Face
ac7ebac
Raw
History Blame Contribute Delete
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