Hello, I have been trying to implement a custom preprocessor that replaces certain words in the received message by fuzzy matching. I have tried to import a function that I wrote but when I set the message_preprocessor to the function it does not change and stays None.
Here is the code for the fuzzy matching function:
from fuzzywuzzy import process FUZZY_SEARCH_DATA = ['krzysztof', 'laura', 'agnieszka', 'milena'] def fuzzy_match_preprocessor(message): words = message.split() new_string =  for word in words: fuzzy_matched_value = process.extractOne(word, FUZZY_SEARCH_DATA, score_cutoff= 65) if fuzzy_matched_value != None: new_string.append(fuzzy_matched_value.lower()) else: new_string.append(word) message_text = ' '.join(new_string) return message_text
I import it from a file called fuzzy_matcher.py with this line:
from rasa.core.fuzzy_matcher import fuzzy_match_preprocessor
And this is how it is assigned to the message_preprocessor:
message_preprocessor: Optional[LambdaType] = fuzzy_match_preprocessor
Any help would be appreciated.