spaCy icon indicating copy to clipboard operation
spaCy copied to clipboard

Lemmatizer on "best" returns token "good"

Open timforr opened this issue 6 years ago • 5 comments

The 'en' lemmatizer lemmatizes the word "best" in to "good"

How to reproduce the behaviour:

nlp = spacy.load('en') test = nlp("best") test[0].lemma_

'good'

timforr avatar Jan 03 '20 21:01 timforr

I think that good is fine as a lemma for best. What did you expect the lemma to be?

adrianeboyd avatar Jan 04 '20 09:01 adrianeboyd

I expected it to return "best", not "good". They have different meanings, and I don't want Spacy do make those decisions for me.

timforr avatar Jan 06 '20 16:01 timforr

good-better-best is a typical paradigm that's handled by a lemmatizer, so I think spacy's output is okay here.

The exact definition of "lemma" can vary from tool to tool and the kinds of lemmas you want can also vary a bit from task to task, so spacy's lemmatizer might not be the right tool for your task or you may need to customize it.

best as an adjective is handled by a lemmatizer exception and you can modify it like this:

nlp.vocab.lookups.get_table("lemma_exc")["adj"]["best"] = ["new_lemma"]

You can see all the lemmatizer data in the package spacy-lookups-data.

adrianeboyd avatar Jan 06 '20 16:01 adrianeboyd

Alright, that makes sense. Thanks for the info on how to update the lemmatizer.

timforr avatar Jan 06 '20 17:01 timforr

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Feb 05 '20 19:02 lock[bot]