Creating Custom Components (Input and Output)

Hello all, I am attempting to create my own custom rasa nlu components (hopefully a tokenizer and an intent classifier that uses keras). While there are many custom components online that have some explanation (such as the blog post done by Rasa on Sentiment Analysis), I am having trouble understanding the way in which these components are taking in data and then sending it out. I come from a tensorflow ML background and therefore I am used to taking in data as numpy arrays (or TF tensors) and the model out as a .h5. Any explanation on how Rasa handles this would be very much appreciated. Thanks!

Hey @aidanloch, this depends on what type of component you’re building. Tokenizers for example would provide text: rasa/whitespace_tokenizer.py at 1.7.x · RasaHQ/rasa · GitHub

Classifiers would provide intent labels and their rankings/confidences: rasa/embedding_intent_classifier.py at 1.7.x · RasaHQ/rasa · GitHub

Could you elaborate a bit more on the classifier part please? I am trying to build a custom classifier and so far I do not understand, how I could achieve a ranking of my responses.

So what I’m trying to do is to create a custom response selector that ranks the responses from the training data by cosine similarity of their BOW representation to the user input. Therefore I think I need to access all the responses in the process method of my custom classifier class. But how can i do that?