spaCy ile İleri Düzey NLP
Ines Montani
spaCy core developer
Vocab: birden çok belge arasında paylaşılan verileri saklarStringStore içinde nlp.vocab.strings aracılığıyla yalnızca bir kez saklanırcoffee_hash = nlp.vocab.strings['coffee']
coffee_string = nlp.vocab.strings[coffee_hash]
# Dizeyi daha önce görmediysek hata verir
string = nlp.vocab.strings[3197928453018144401]
nlp.vocab.strings içinde arayındoc = nlp("I love coffee") print('hash value:', nlp.vocab.strings['coffee'])print('string value:', nlp.vocab.strings[3197928453018144401])
hash value: 3197928453018144401string value: coffee
doc da vocab ve strings'e erişirdoc = nlp("I love coffee")
print('hash value:', doc.vocab.strings['coffee'])
hash value: 3197928453018144401
Lexeme nesnesi, sözlükte bir kayıttırdoc = nlp("I love coffee") lexeme = nlp.vocab['coffee']# sözcüksel öznitelikleri yazdır print(lexeme.text, lexeme.orth, lexeme.is_alpha)
coffee 3197928453018144401 True
lexeme.text ve lexeme.orth (hash)lexeme.is_alpha gibi sözcüksel öznitelikler
spaCy ile İleri Düzey NLP