def create_documents(
        self, texts: list[str], metadatas: Optional[list[dict]] = None
    ) -> list[SplitterDocument]:
        """Create documents from a list of texts."""
        _metadatas = metadatas or [{}] * len(texts)
        documents = []
        for i, text in enumerate(texts):
            index = 0
            previous_chunk_len = 0
            for chunk in self.split_text(text):
                metadata = copy.deepcopy(_metadatas[i])
                if self._add_start_index:
                    offset = index + previous_chunk_len - self._chunk_overlap
                    index = text.find(chunk, max(0, offset))
                    metadata["start_index"] = index
                    previous_chunk_len = len(chunk)
                new_doc = SplitterDocument(
                    page_content=chunk, metadata=metadata
                )
                documents.append(new_doc)
        return documents
Create documents from a list of texts.
py/shared/utils/splitter/text.py