NLP Lanjutan dengan spaCy
Ines Montani
spaCy core developer
Vocab: menyimpan data yang dibagi lintas banyak dokumenStringStore melalui nlp.vocab.stringscoffee_hash = nlp.vocab.strings['coffee']
coffee_string = nlp.vocab.strings[coffee_hash]
# Error jika string belum pernah terlihat
string = nlp.vocab.strings[3197928453018144401]
nlp.vocab.stringsdoc = nlp("I love coffee") print('hash value:', nlp.vocab.strings['coffee'])print('string value:', nlp.vocab.strings[3197928453018144401])
hash value: 3197928453018144401string value: coffee
doc juga mengekspos vocab dan stringsdoc = nlp("I love coffee")
print('hash value:', doc.vocab.strings['coffee'])
hash value: 3197928453018144401
Lexeme adalah entri dalam vocabularydoc = nlp("I love coffee") lexeme = nlp.vocab['coffee']# cetak atribut leksikal print(lexeme.text, lexeme.orth, lexeme.is_alpha)
coffee 3197928453018144401 True
lexeme.text dan lexeme.orth (hash)lexeme.is_alpha
NLP Lanjutan dengan spaCy