Every time when run bot with custom component getting "token none"

I created a custom component using Rasa 2.7.1, where I want to use tokens. But every time, if I run the chatbot, I get the error “tokens none”. Same as in this post: Tokens None from previous component(RASA custom component). I implemented the suggested solution, but it did not solve the problem. The chatbot is in hungarian (using Spacy implementation). I tried to run the bot in English too (rewrote it both in custom component and config file too), but nothing changed, I got the same results. Below you can see the codes “custom_component.py” and “config.yml” for better understanding.

Used forum posts for the project: Using FuzzyWuzzy with lookup tables Tokens None from previous component(RASA custom component)

Thank you in advance for your help.


from rasa.nlu.components import Component from rasa.shared.nlu.training_data.message import Message from fuzzywuzzy import process

class FuzzyExtractor(Component): name = “Fuzzy” provides = [“entities”] requires = [“tokens”] defaults = {} language_list = [“hu”] threshold = 85

def __init__(self, component_config=None, *args):
    super(FuzzyExtractor, self).__init__(component_config)

def train(self, training_data, cfg, **kwargs):

def process(self, message, **kwargs):
        entities = {}

    cur_path = os.path.dirname(__file__)
    if os.name == 'nt':
        partial_lookup_file_path = '.\data\city.yml'
        partial_lookup_file_path = './data/city.yml'
    lookup_file_path = os.path.join(cur_path, partial_lookup_file_path)

    with open(lookup_file_path, 'r', encoding = "utf8") as file:
        lookup_data = yaml.load(file, Loader=yaml.FullLoader)
            tokens =  [t.text for t in message.get("tokens")]
            print('tokens', tokens)
            print("An exception occurred")
            for token in tokens:
                fuzzy_results = process.extract(

            print('fuzzy_results', fuzzy_results)

            for result, confidence in fuzzy_results:
                if confidence >= self.threshold:
                        "start": token.offset,
                        "end": token.end,
                        "value": token.text,
                        "fuzzy_value": result["value"],
                        "confidence": confidence,
                        "entity": result["entity"]
            print("An exception occurred")

    message.set("entities", entities, add_to_output=True)


language: hu


  • name: SpacyNLP model: hu_core_ud_lg
  • name: SpacyTokenizer
  • name: custom_component.FuzzyExtractor
  • name: SpacyFeaturizer
  • name: RegexFeaturizer case_sensitive: False
  • name: CountVectorsFeaturizer
  • name: services.hun_date_extractor.HunDateExtractor
  • name: RegexEntityExtractor
  • name: EntitySynonymMapper
  • name: DIETClassifier epochs: 100 entity_recognition: false
  • name: FallbackClassifier threshold: 0.35
  • name: ResponseSelector epochs: 100


  • name: MemoizationPolicy
  • name: TEDPolicy max_history: 5 epochs: 100
  • name: RulePolicy

@Sierra your code is running? Just checking as you used FuzzyExtract.

Yes it is running. For example if the input is ‘szia’ (hi in hungarian) the output running rasa shell --debug is: entities [] message <rasa.shared.nlu.training_data.message.Message object at 0x00000261D8A30190> An exception occurred An exception occurred

So I assume that in these part of the code:

            tokens =  [t.text for t in message.get("tokens")]
            print('tokens', tokens)
            print("An exception occurred")

there is no token available, but I don’t know why.

@Sierra Did you have a idea of this

# use process.extract(.. limits = 3) to get multiple close matches


process.extractOne. or

fuzzy_result=process.extractOne(token.text, lookup_data, socrer= fuzz.token_set_ratio)

if fuzzy_result > 80:
 rest code

You need to check the score of token.text and lookup_data, not the confidence I guess.

Please check the FuzzyWuzzy more in details. I just given you my initial observation and suggestion. I hope you get my point on this.


@nik202 Thanks for the recommendation.

You are right, I definitely have to reconsider to changing that later in my code.

My main problem is that I don’t reach that part of the code yet, because I can’t get any value. For some unknown reasons I don’t have tokens. It looks like SpacyTokenizer don’t work correctly, or maybe at all. Do you have any suggestions for that? Should I replace SpacyTokenizer or something else?

@Sierra Go with main configuration pipeline rather then Spacy.