# InvalidConfigException for my custom tokenizer class

**URL:** <https://forum.rasa.com/t/invalidconfigexception-for-my-custom-tokenizer-class/57086>\
**Category:** Rasa Open Source\
**Created:** [February 5, 2023, 6:11pm UTC](https://forum.rasa.com/t/invalidconfigexception-for-my-custom-tokenizer-class/57086 "2023-02-05T18:11:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cergo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/cergo/32/22389_2.png) [@cergo](https://forum.rasa.com/u/cergo)\
**Post date:** [February 5, 2023, 6:11pm UTC](https://forum.rasa.com/t/invalidconfigexception-for-my-custom-tokenizer-class/57086/1 "2023-02-05T18:11:38Z")

</div>

I am trying to create my custom tokenizer class with the following after rasa init:

KLPTTokenizer.py (the same path of config.yml):

```python
from __future__ import annotations
from typing import Any, Dict, Text, List
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
from rasa.nlu.tokenizers.tokenizer import Tokenizer, Token
from klpt.tokenize import Tokenize
from rasa.shared.nlu.training_data.message import Message

@DefaultV1Recipe.register(
    component_types=[DefaultV1Recipe.ComponentType.MESSAGE_TOKENIZER],
    is_trainable=True
)
class KLPTTokenizer(Tokenizer):

    def __init__ (self, config: Dict[Text, Any]) -> None:
        super(). __init__ (config)
        self._tokenizer = Tokenize("Kurmanji", "Latin")

    def tokenize(self, message: Message, attribute: Text) -> List[Token]:
        return self._tokenizer.word_tokenize(message.get(attribute))

    @staticmethod
    def required_packages() -> List[Text]:
        current = super().required_packages()
        current.append("klpt")
        return current

```

config.yml:

```yaml
recipe: default.v1
language: ku
pipeline:
- name: KLPTTokenizer
  component_type: message_tokenizer
  class_name: KLPTTokenizer
policies:

```

requirements.txt (all installed):

```plaintext
rasa[full]
klpt
rasa-nlu

```

The rasa version:

```plaintext
Rasa Version : 3.4.2
Minimum Compatible Version: 3.0.0
Rasa SDK Version : 3.4.0
Python Version : 3.8.10
Operating System : Linux-5.15.0-58-generic-x86_64-with-glibc2.29
Python Path : /home/cergo/Desktop/Kurdish-Rasa/venv/bin/python

```

The error I get when run `rasa train`:

```plaintext
InvalidConfigException: Can't load class for name 'KLPTTokenizer'. Please make sure to provide a valid name or module path and to register it using the '@DefaultV1Recipe.register' decorator.

```
