Spaces:
Sleeping
Sleeping
Download pipeline/chunking/__init__.py from samithcs/RAG_Book_QA_System: direct link, hf CLI and curl.
- Browser
- Download file 433 Bytes
-
https://huggingface.co/spaces/samithcs/RAG_Book_QA_System/resolve/main/pipeline/chunking/__init__.py
- Command line
-
hf download hf://spaces/samithcs/RAG_Book_QA_System/pipeline/chunking/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/samithcs/RAG_Book_QA_System/resolve/main/pipeline/chunking/__init__.py
433 Bytes
| from .fixed_chunker import FixedChunker | |
| from .semantic_chunker import SemanticChunker | |
| def chunk_text(text: str, chunk_size: int, overlap: int, method="fixed"): | |
| if method == "fixed": | |
| return FixedChunker().chunk(text, chunk_size, overlap) | |
| elif method == "semantic": | |
| return SemanticChunker().chunk(text, chunk_size, overlap) | |
| else: | |
| raise ValueError("Unknown chunking method: " + str(method)) |