🔤 Word Embeddings - Word2Vec और GloVe की समझ (हिंदी में)
Word Embeddings NLP की वो तकनीक है जो शब्दों को ऐसे vector (numbers) में बदलती है जो उनके meaning को भी represent करता है। इससे machine न केवल शब्द को पहचानती है, बल्कि उनके semantic relationship को भी समझती है।
🧠 Word Embedding क्या होता है?
Word Embedding एक technique है जिसमें हर शब्द को एक dense vector में represent किया जाता है। यह vector शब्द के अर्थ और context को भी capture करता है।
- Embeddings की dimension: 50, 100, 300 या अधिक
- Contextual Meaning को preserve करता है
- Semantic similarity को मापने में सहायक
📌 Word2Vec क्या है?
Word2Vec एक neural network-based model है जो एक बड़े टेक्स्ट डाटा से शब्दों के embeddings सीखता है। यह दो प्रकार के model देता है:
- CBOW (Continuous Bag of Words): Context से Target Word को predict करता है
- Skip-Gram: Target Word से Context को predict करता है
from gensim.models import Word2Vec sentences = [["AI", "भविष्य", "है"]] model = Word2Vec(sentences, vector_size=100, window=5, min_count=1, workers=4) print(model.wv["AI"])
📚 GloVe क्या है?
GloVe (Global Vectors) एक statistical model है जो word co-occurrence matrix का उपयोग करके embeddings सीखता है। यह Stanford द्वारा बनाया गया था।
- Global word occurrence पर आधारित
- Pre-trained vectors आसानी से उपलब्ध हैं
- Memory efficient और fast
📊 Word2Vec vs GloVe तुलना
फीचर | Word2Vec | GloVe |
---|---|---|
आधार | Neural Network | Matrix Factorization |
Speed | Fast | Faster for pre-trained |
Context | Local | Global |
✅ निष्कर्ष
Word Embeddings NLP में बहुत ही powerful concept है जो टेक्स्ट को meaningful numbers में बदलता है। Word2Vec और GloVe दोनों की अपनी ताकतें हैं और इन्हें आपकी application के आधार पर चुना जा सकता है।
🚀 अगले ब्लॉग में: Sentiment Analysis (Hindi में)