Vocabulaire, hachages et lexèmes
Pourquoi ce code génère-t-il une erreur ?
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])
La classe de langue English est déjà disponible sous forme d’objet nlp.
Cet exercice fait partie du cours
NLP avancé avec spaCy
Exercice interactif pratique
Passez de la théorie à la pratique avec l’un de nos exercices interactifs
Commencer l’exercice