Download src/rag/utils.py from lotran12/lllm2: direct link, hf CLI and curl.
- Browser
- Download file 533 Bytes
-
https://huggingface.co/spaces/lotran12/lllm2/resolve/main/src/rag/utils.py
- Command line
-
hf download hf://spaces/lotran12/lllm2/src/rag/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/lotran12/lllm2/resolve/main/src/rag/utils.py
533 Bytes
| from langchain_text_splitters import RecursiveCharacterTextSplitter | |
| class TextSplitter: | |
| def __init__(self, | |
| seperators: List[str] = ['\n\n', '\n', ' ', ''], | |
| chunk_size: int = 300, | |
| chunk_overlap: int = 0) -> None: | |
| self.splitter = RecursiveCharacterTextSplitter( | |
| separators=seperators, | |
| chunk_size=chunk_size, | |
| chunk_overlap=chunk_overlap | |
| ) | |
| def __call__(self, documents): | |
| return self.splitter.split_documents(documents) | |