1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. NLP nâng cao với spaCy

Connected

Bài tập

Vocab, hash và lexeme

Vì sao đoạn mã này lại báo lỗi?

from spacy.lang.en import English
from spacy.lang.de import German

# Create an English and German nlp object
nlp = English()
nlp_de = German()
# Get the ID for the string 'Bowie'
bowie_id = nlp.vocab.strings['Bowie']
print(bowie_id)

# Look up the ID for 'Bowie' in the vocab
print(nlp_de.vocab.strings[bowie_id])

Lớp ngôn ngữ English đã có sẵn dưới dạng đối tượng nlp.

Hướng dẫn

50 XP

Các phương án trả lời