enchant.request_pwl_dict() in Python
Enchant is a module in python which is used to check the spelling of a word, gives suggestions to correct words. Also, gives antonym and synonym of words. It checks whether a word exists in dictionary or not.
enchant.request_pwl_dict() is an inbuilt method of
enchant module. It is used to build a custom dictionary also known as Personal Word List(PSL).
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Syntax : enchant.request_pwl_dict(text_file)
text_file : the path of the text file which contains the words to be included, one word per line.
Returns : a Dict object
The contents of the sample file “PWL.txt” are:
Example 2: Adding new words to the PWL dictionary using
File contents: qwerty jabba gfg The word asd does not exists in the dictionary File contents: qwerty jabba gfg asd The word asd exists in the dictionary