Skip to content

How to get nodes relationships with RecursiveCharacterTextSplitter #29899

Answered by dosubot bot
Danana1 asked this question in Ask Dosu
Discussion options

You must be logged in to vote

I found a similar unsolved discussion on this topic: How to get nodes relationships with RecursiveCharacterTextSplitter, which was last updated on February 18, 2025 [1].

To obtain the order of nodes and their start and end character indices when using RecursiveCharacterTextSplitter, you can use the add_start_index parameter. This parameter, when set to True, will add the start index of each chunk in the metadata of the resulting Document objects. Here's an example:

from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_core.documents import Document

# Example text
text = "w1 w1 w1 w1 w1 w1 w1 w1 w1"

# Initialize the RecursiveCharacterTextSplitter with add_st…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Danana1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant