I am trying to create a new response selector: How to prepare features for the class?

Hi all,

I cannot get the response selector to work, so I am trying to write a new response selector. As the original selector, I inherit the DIETClassifier.

The examples I get during training (method preprocess_train_data), contain two features (intent & response_key). What I want to do, is to combine these two into a new attribute (this is easy). DIETClassifier’s method “_create_model_data”, uses the “intent” attribute for the class. Then, it generates features for the “intent” attribute. (It calls method _extract_features(example, “intent”)).

If I replace “intent” with my one new feature (“intent_response_key”) I get an error:

File "/home/pepper/airobots/athens_international_airport/airobots/venv-python3.7/lib64/python3.7/site-packages/rasa/nlu/classifiers/diet_classifier.py", line 425, in _extract_features
    if message.get(SPARSE_FEATURE_NAMES[attribute]) is not None:
KeyError: 'intent_response_key'

SPARSE_FEATURE_NAMES is: {‘text’: ‘text_sparse_features’, ‘intent’: ‘intent_sparse_features’, ‘response’: ‘response_sparse_features’}

Somehow I must add my new key in this dict. “intent_sparse_features” is not in the training examples.

How can I encode the classes I want to use in DIETClassifier?


Well, I managed to create the new selector. Is there a way to get all responses declared in the responses.md file?

Or at least get the path of the file, to load it directly?

Hey @petasis

Have you tried the response selector from 2.0 release? We don’t seem to have any problems with it there.