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

Empty MorphAnalysis Hash differs from Token.morph.key #13725

Open
thjbdvlt opened this issue Dec 26, 2024 · 0 comments
Open

Empty MorphAnalysis Hash differs from Token.morph.key #13725

thjbdvlt opened this issue Dec 26, 2024 · 0 comments

Comments

@thjbdvlt
Copy link
Contributor

Hello,

I've trained a Morphologizer and i saw that empty MorphAnalysis ("") actually have the hash value of "_". Is it by design? Because the documentation doesn't mention this.

key int | The hash of the features string.

for i in doc:
    nlp.vocab.strings[i.morph.key] == str(i.morph)
False
False
False
True
False
True
True
False

As i use the hash values in a lookup for something, it produced KeyError.

How to reproduce the behaviour

Your Environment

  • Operating System: Linux (Debian 12)
  • Python Version Used: 3.11
  • spaCy Version Used: 3.7.3 (i will train my Morphologizer soon on 3.8.3 to see if that change)
  • Environment Information:
@thjbdvlt thjbdvlt changed the title Empty MorphAnalysis Hash differs from str(Token.morph) Empty MorphAnalysis Hash differs from Token.morph.key Dec 26, 2024
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