Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

German model lemmatizes punctuation inconsistently #13729

Open
Michael-E-Rose opened this issue Jan 15, 2025 · 0 comments
Open

German model lemmatizes punctuation inconsistently #13729

Michael-E-Rose opened this issue Jan 15, 2025 · 0 comments

Comments

@Michael-E-Rose
Copy link

Michael-E-Rose commented Jan 15, 2025

I'm on Python 3.11 with spacy 3.7.4 and noted an inconsistent behavior when I lemmatize my German text.

How to reproduce the behaviour

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_}'")

Output:

Text: '(', Lemma: '--'
Text: 'Das', Lemma: 'der'
Text: 'ist', Lemma: 'sein'
Text: 'ein', Lemma: 'ein'
Text: 'Test', Lemma: 'Test'
Text: '!', Lemma: '--'
Text: ')', Lemma: '--'

However, note the English standard model:

import spacy

nlp = spacy.load("en_core_web_sm")
doc = nlp("(This is a test!)")
for token in doc:
    print(f"Text: '{token.text}', Lemma: '{token.lemma_}'")

Output:

Text: '(', Lemma: '('
Text: 'This', Lemma: 'this'
Text: 'is', Lemma: 'be'
Text: 'a', Lemma: 'a'
Text: 'test', Lemma: 'test'
Text: '!', Lemma: '!'
Text: ')', Lemma: ')'

On StackOverlow, the answer-giver reported the Dutch model treats punctuation as in English.

Your Environment

  • Operating System: Windows
  • Python Version Used: 3.11
  • spaCy Version Used: 3.7.4
  • Environment Information: locally (no venv or container)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant