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 also provides the
enchant.tokenize module to tokenize text. Tokenizing involves splitting words from the body of the text. But at times not all the words are required to be tokenized. Suppose we have and HTML file, on tokenization all the tags will also be included. Usually the HTML tags do not contribute to the content of the article, therefore there is a need to tokenize excluding them.
Currently the only implemented chunker is HTMLChunker. A chunker for LaTeX documents is in the works.
Printing tokens without chunking:
[(‘div’, 1), (‘h’, 7), (‘Geeks’, 11), (‘for’, 17), (‘Geeks’, 21), (‘h’, 29), (‘br’, 34), (‘div’, 40)]
Printing tokens after chunking:
[(‘Geeks’, 11), (‘for’, 17), (‘Geeks’, 21)]
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.
- Python - Tokenize text using Enchant
- Python - Filtering text using Enchant
- NLP | Chunking using Corpus Reader
- NLP | Classifier-based Chunking | Set 2
- NLP | Chunking and chinking with RegEx
- NLP | Chunking Rules
- NLP | Classifier-based Chunking | Set 1
- NLP | Distributed chunking with Execnet
- Get similar words suggestion using Enchant in Python
- Python - Spelling checker using Enchant
- Python - Find the Levenshtein distance using Enchant
- enchant.list_languages() in Python
- enchant.dict_exists() in Python
- enchant.Dict() in Python
- enchant.DictWithPWL() in Python
- enchant.request_pwl_dict() in Python
- enchant.get_enchant_version() in Python
- enchant.request_dict() in Python
- Convert Text and Text File to PDF using Python
- Python: Convert Speech to text and text to Speech
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.