# Spelling mistake create new pipeline

**URL:** <https://forum.rasa.com/t/spelling-mistake-create-new-pipeline/17756>\
**Category:** Rasa Open Source\
**Created:** [September 30, 2019, 5:55pm UTC](https://forum.rasa.com/t/spelling-mistake-create-new-pipeline/17756 "2019-09-30T17:55:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolas](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@nicolas](https://forum.rasa.com/u/nicolas)\
**Post date:** [September 30, 2019, 5:55pm UTC](https://forum.rasa.com/t/spelling-mistake-create-new-pipeline/17756/1 "2019-09-30T17:55:10Z")

</div>

Hi ,i need create a Custom pipeline for spell correction, is there any implemented for example fuzzywuzzy python library or is necessary write a new Custom pipeline?. I listen opinions. other opcions is create new pipeline among all, since I notice that it is a general problem.

---

<div class="post-metadata">

**Author:** ![Gehova](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Gehova](https://forum.rasa.com/u/Gehova)\
**Post date:** [September 30, 2019, 7:16pm UTC](https://forum.rasa.com/t/spelling-mistake-create-new-pipeline/17756/2 "2019-09-30T19:16:44Z")

</div>

You can make one [custom component](https://blog.rasa.com/enhancing-rasa-nlu-with-custom-components/) with pyspellchecker, it has the advantage that you can add your words and create a [personalized dictionary](https://pyspellchecker.readthedocs.io/en/latest/quickstart.html#how-to-build-a-new-dictionary). The way I made this, it should be added at the beginning of your pipeline.

```auto
from rasa.nlu.components import Component
from rasa.nlu.training_data import Message
import typing
from typing import Any, Optional, Text, Dict

if typing.TYPE_CHECKING:
    from rasa.nlu.model import Metadata

from spellchecker import SpellChecker

class SpellCheckerEN(Component):

    provides = ["text"]
    defaults = {}
    language_list = ["en"]

    def __init__ (self, component_config=None):
        super(SpellCheckerEN, self). __init__ (component_config)

    def process(self, message, **kwargs):
        mt = message.text
        str = mt.translate(mt.maketrans('', '', '!\"#$%&\'()*+,.-:;<=>?@[\]^_`{|}~'))
        words = str.split(' ')
        spell = SpellChecker(language=None)
        spell.word_frequency.load_dictionary('my_en_dict.gz')
        
        for word in words:
            if word not in spell:
                mt = mt.replace(word, spell.correction(word))

        message.text = mt

    @classmethod
    def load(
        cls,
        meta: Dict[Text, Any],
        model_dir: Optional[Text] = None,
        model_metadata: Optional["Metadata"] = None,
        cached_component: Optional["Component"] = None,
        **kwargs: Any
    ) -> "Component":
        if cached_component:
            return cached_component
        else:
            return cls(meta)

```

---

<div class="post-metadata">

**Author:** ![nicolas](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@nicolas](https://forum.rasa.com/u/nicolas)\
**Post date:** [October 1, 2019, 12:27pm UTC](https://forum.rasa.com/t/spelling-mistake-create-new-pipeline/17756/3 "2019-10-01T12:27:58Z")

</div>

thank for the code

---

<div class="post-metadata">

**Author:** ![wim.de.webmaster](https://avatars.discourse-cdn.com/v4/letter/w/b77776/32.png) [@wim.de.webmaster](https://forum.rasa.com/u/wim.de.webmaster)\
**Post date:** [November 6, 2019, 2:18pm UTC](https://forum.rasa.com/t/spelling-mistake-create-new-pipeline/17756/4 "2019-11-06T14:18:01Z")

</div>

You are running a local installation of Rasa? I want to try this out, but we are running a Docker environment and I think I need to find a way to install the pyspellchecker module into the Rasa container… anybody tried this already?

---

<div class="post-metadata">

**Author:** ![mpbalshetwar](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@mpbalshetwar](https://forum.rasa.com/u/mpbalshetwar)\
**Post date:** [February 8, 2020, 6:17am UTC](https://forum.rasa.com/t/spelling-mistake-create-new-pipeline/17756/5 "2020-02-08T06:17:05Z")

</div>

Hey @wim.de.webmaster,

Actually i am building Docker environment and having trouble with it. would you mind sharing some of your material on that?

---

<div class="post-metadata">

**Author:** ![Nikhilcheke](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@Nikhilcheke](https://forum.rasa.com/u/Nikhilcheke)\
**Post date:** [October 13, 2020, 4:18am UTC](https://forum.rasa.com/t/spelling-mistake-create-new-pipeline/17756/6 "2020-10-13T04:18:04Z")

</div>

You can refer this article, where pyspellchecker python library is used for correcting spelling mistakes, [custom component for spell checking](https://medium.com/@nicks.cheke44/building-rasa-nlu-custom-component-for-spell-checking-in-incoming-message-742527b35d27)
