spaCy के साथ Natural Language Processing
Azadeh Mobasher
Principal Data Scientist
{"I": 1, "got": 2, ...}
| Sentences | I | got | covid | coronavirus |
|---|---|---|---|---|
| I got covid | 1 | 2 | 3 | |
| I got coronavirus | 1 | 2 | 4 |
Word vectors बनाने के कई तरीके:
एक word vector का उदाहरण:
en_core_web_md में 20,000 शब्दों के लिए 300-dimensional vectors हैं.
import spacy
nlp = spacy.load("en_core_web_md")
print(nlp.meta["vectors"])
>>> {'width': 300, 'vectors': 20000, 'keys': 514157,
'name': 'en_vectors', 'mode': 'default'}
nlp.vocab: vocabulary (Vocab class) एक्सेस करने के लिएnlp.vocab.strings: vocabulary में word IDs एक्सेस करने के लिएimport spacy
nlp = spacy.load("en_core_web_md")
like_id = nlp.vocab.strings["like"]
print(like_id)
>>> 18194338103975822726
.vocab.vectors: किसी मॉडल या शब्द के vectors उसके ID से एक्सेस करेंprint(nlp.vocab.vectors[like_id])
>>> array([-2.3334e+00, -1.3695e+00, -1.1330e+00, -6.8461e-01, ...])
spaCy के साथ Natural Language Processing