शुरू करेंमुफ़्त में शुरू करें

टेक्स्ट स्प्लिटिंग की शुरुआत

अब स्प्लिट करना शुरू करें! आपको RAG के बारे में एक स्टेटमेंट दिया गया है जो स्ट्रिंग वैरिएबल text में स्टोर है. आपका काम है इस स्ट्रिंग को '.' कैरेक्टर के स्थानों पर स्प्लिट करना. इस स्ट्रैटेजी के नतीजे देखकर जाँचिए कि यह कैसे काम करती है.

यह अभ्यास पाठ्यक्रम का हिस्सा है

LangChain के साथ Retrieval Augmented Generation (RAG)

पाठ्यक्रम देखें

अभ्यास निर्देश

  • ऐसा LangChain कैरेक्टर टेक्स्ट स्प्लिटर डिफाइन करें जो '.' कैरेक्टर पर स्प्लिट करे, जिसमें chunk size 75 और chunk overlap 10 हो.
  • आपके द्वारा डिफाइन किए गए text_splitter का उपयोग करके text को स्प्लिट करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

text = '''RAG (retrieval augmented generation) is an advanced NLP model that combines retrieval mechanisms with generative capabilities. RAG aims to improve the accuracy and relevance of its outputs by grounding responses in precise, contextually appropriate data.'''

# Define a text splitter that splits on the '.' character
text_splitter = ____(
    ____,
    ____,  
    ____  
)

# Split the text using text_splitter
chunks = text_splitter.____
print(chunks)
print([len(chunk) for chunk in chunks])
कोड संपादित करें और चलाएँ