Bird
0
0

Given a text of 300 tokens and a TokenTextSplitter with chunk_size=100 and chunk_overlap=10, how many chunks will be produced?

medium📝 component behavior Q4 of 15
LangChain - Text Splitting
Given a text of 300 tokens and a TokenTextSplitter with chunk_size=100 and chunk_overlap=10, how many chunks will be produced?
A3
B4
C5
D6
Step-by-Step Solution
Solution:
  1. Step 1: Calculate chunk ranges with overlap

    Chunks are 100 tokens each, overlapping by 10 tokens, so each new chunk starts 90 tokens after previous start.
  2. Step 2: Determine number of chunks for 300 tokens

    Chunks start at tokens 0, 90, 180, 270. The last chunk covers tokens 270-370 (exceeds text length but allowed). So 4 chunks total.
  3. Final Answer:

    4 -> Option B
  4. Quick Check:

    Chunks with overlap = 4 [OK]
Quick Trick: Chunks start every chunk_size - chunk_overlap tokens [OK]
Common Mistakes:
  • Ignoring overlap in calculation
  • Assuming chunks fit exactly without overlap
  • Counting chunks as text length divided by chunk_size

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes