-1

I am importing spell successfully, but getting a LookupError when using it.

from hunspell import spell 
print(spell('Heello'))

---------------------------------------------------------------------------
LookupError                               Traceback (most recent call last)
<ipython-input-44-d22185ace6e6> in <module>
----> 1 print(spell('Hey'))

LookupError: unknown encoding: 
Samir Ahmane
  • 830
  • 7
  • 22

1 Answers1

1

The problem is that you are calling spell directly. You should initialize Hunspell with which dictionary you want to use:

import hunspell

hobj = hunspell.HunSpell('/usr/share/hunspell/en_US.dic', '/usr/share/hunspell/en_US.aff')
print(hobj.spell("Heellow"))

Dictionaries can be found in: https://github.com/wooorm/dictionaries

Roomm
  • 905
  • 11
  • 23