1

I'm using enchant module. It has an attribute DictWithPWL to add personal word list to existing dictionary that is pre-defined. But i'm getting below error:

def dictionary_words_finder(word_lst):
    meaningful_word = []
    # creating a dictionary object for checking a word is in dictionary or not and also adding 
    # our personal word list from words.txt
    eng_dictionary = enchant.DictWithPWL("en_US", 'words.txt')
    for word in word_lst:
    
      if not eng_dictionary.check(word):
        continue
      else:
        meaningful_word.append(word)
    
    return meaningful_word`

But i'm getting below error:

AttributeError: module 'enchant' has no attribute 'DictWithPWL'

Please let me know if there any other way for doing this task if you don't have a solution to above problem.

I've installed the enchant module using !pip install enchant. Enchant module got installed successfully but the problem is not resolved. Also I've search for other methods for doing same task but can't find any such module or methods.

I expect that above written code should not throw AttributeError by making some changes to the above code.

I've also gone through documentation here --> https://pyenchant.github.io/pyenchant/tutorial.html enchant.DictWithPWL is still in their documentation but can't get where i'm doing it wrong. Please help.

Albina
  • 1,901
  • 3
  • 7
  • 19
code-switch
  • 11
  • 1
  • 5

1 Answers1

2

You installed the wrong package. The package you're trying to use is named PyEnchant in PyPI. Try uninstalling enchant and installing PyEnchant.

ConchDev
  • 79
  • 7