Код: Выделить всё
import spacy
nlp = spacy.load("de_core_news_sm")
doc = nlp("(Das ist ein Test!)")
for token in doc:
print(f"Text: '{token.text}', Lemma: '{token.lemma_}'")
Код: Выделить всё
Text: '(', Lemma: '--'
Text: 'Das', Lemma: 'der'
Text: 'ist', Lemma: 'sein'
Text: 'ein', Lemma: 'ein'
Text: 'Test', Lemma: 'Test'
Text: '!', Lemma: '--'
Text: ')', Lemma: '--'
Я использую версию 3.7.4 с Питон 3.11
Подробнее здесь: https://stackoverflow.com/questions/793 ... n-in-spacy