Custom component for Spell Checking

Hello everyone, I’m building a custom component for spell checking. Basically the custom component will be at the beginning of the pipeline (before WhitespaceTokenizer) and need to change the received message (in my case the message will be received through a HTTP request, fix the typos in the custom component and send the new message to WhitespaceTokenizer). I saw the blog post by Justina Petraityte and the docs, but can’t figure out how to proceed in my specific case. I think my component only needs the process method to manipulate the message parameter, but how do I use the message.set() next? And what to use in the provides (if I need to use it)?

So, basically:

def process(self, message, **kwargs):
    new_message = self.spell_check(message) #Check and fix message.text
    #What to do here?
    message.set("?", ?, add_to_output=True)

Thanks for any help!

I got help on another post and, apparently, everything’s working fine now. In case of someone else has a similar doubt, I solved my problem in the following way:

def process(self, message, **kwargs):
    new_message = self.spell_check(message.text)
    message.text = new_message