Skip to content

Printer

Here's an example configuration file that demonstrates how the custom printer component works.

Configurable Variables

  • alias: gives an extra name to the component and adds an extra message that is printed

Base Usage

When running this example you'll notice that what the effect is of the CountVectorsFeaturizer. You should see print statements appear when you talk to the assistant.

language: en

pipeline:
- name: WhitespaceTokenizer
- name: LexicalSyntacticFeaturizer
- name: rasa_nlu_examples.meta.Printer
  alias: before count vectors
- name: CountVectorsFeaturizer
  analyzer: char_wb
  min_ngram: 1
  max_ngram: 4
- name: rasa_nlu_examples.meta.Printer
  alias: after count vectors
- name: DIETClassifier
  epochs: 100

When you now interact with your model via rasa shell you will see pretty information appear about the state of the Message object. It might look something like this;

{
    'text': 'rasa nlu examples',
    'intent': {'name': 'out_of_scope', 'confidence': 0.4313829839229584},
    'entities': [
        {
            'entity': 'proglang',
            'start': 0,
            'end': 4,
            'confidence_entity': 0.42326217889785767,
            'value': 'rasa',
            'extractor': 'DIETClassifier'
        }
    ],
    'text_tokens': ['rasa', 'nlu', 'examples'],
    'intent_ranking': [
        {'name': 'out_of_scope', 'confidence': 0.4313829839229584},
        {'name': 'goodbye', 'confidence': 0.2445288747549057},
        {'name': 'bot_challenge', 'confidence': 0.23958507180213928},
        {'name': 'greet', 'confidence': 0.04896979033946991},
        {'name': 'talk_code', 'confidence': 0.035533301532268524}
    ],
    'dense': {
        'sequence': {'shape': (3, 25), 'dtype': dtype('float32')},
        'sentence': {'shape': (1, 25), 'dtype': dtype('float32')}
    },
    'sparse': {
        'sequence': {'shape': (3, 1780), 'dtype': dtype('float64'), 'stored_elements': 67},
        'sentence': {'shape': (1, 1756), 'dtype': dtype('int64'), 'stored_elements': 32}
    }
}