This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rasa.nlu.components import Component | |
from rasa.nlu import utils | |
from rasa.nlu.model import Metadata | |
from spellchecker import SpellChecker | |
spell = SpellChecker() | |
class CorrectSpelling(Component): | |
name = "Spell_checker" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from spellchecker import SpellChecker | |
spell = SpellChecker() | |
# find those words that may be misspelled | |
misspelled = spell.unknown(['this', 'is', 'pythen', 'code']) | |
for word in misspelled: | |
print("Misspelled word: "+word+"\nCorrected word: "+spell.correction(word)) |