class_docstr: A key-value store for specific `Messages`.
  
  This container can be only be used to store messages that contain exactly
  one of the following attributes: `ACTION_NAME`, `ACTION_TEXT`, `TEXT`, or `INTENT`.
  A combination of the key attribute and the corresponding value will be used as
  key for the respective message.
  
  Background/Motivation:
  - Our policies only require these attributes to be tokenized and/or featurized
    via NLU graph components, which is why we don't care about storing anything else.
  - Our tokenizers and featurizers work independently for each attribute,
    which is why we can separate them and ask for "exactly one" of the key
    attributes.
  - Our tokenizers add attributes (e.g. token sequences) and not just `Features`,
    which is why we need messages and why we allow messages to contain more than
    just the key attributes.
  - Due to the way we use this datastructure, it won't contain all features that the
    policies need (cf. `rasa.core.featurizers.SingleStateFeaturizer`) and sometimes
    the messages will contain no features at all, which is the motivation for the
    name of this class.
  - Values for different attributes might coincide (e.g. 'greet' can appear as user
    text as well as name of an intent), but attributes are not all tokenized and
    featurized in the same way, which is why we use the combination of key attribute
    and value to identify a message.
  
  Usage:
  - At the start of core's featurization pipeline, we use this container to
    de-duplicate the given story data during training (e.g. "Hello" might appear very
    often but it will end up in the training data only once) and to de-duplicate
    the data given in the tracker (e.g. if a text appears repeatedly in the
    dialogue, it will only be featurized once later).
    See: `rasa.core.featurizers.precomputation.CoreFeaturizationInputConverter`.
  - At the end of core's featurization pipeline, we wrap all resulting
    (training data) messages into this container again.
    See: `rasa.core.featurizers.precomputation.CoreFeaturizationCollector`.
class_docstr_tok: ["A","key-value","store","for","specific","`","Messages","`",".","This","container","can","be","only","be","used","to","store","messages","that","contain","exactly","one","of","the","following","attributes",":","`","ACTION_NAME","`",",","`","ACTION_TEXT","`",",","`","TEXT","`",",","or","`","INTENT","`",".","A","combination","of","the","key","attribute","and","the","corresponding","value","will","be","used","as","key","for","the","respective","message",".","Background\/Motivation",":","-","Our","policies","only","require","these","attributes","to","be","tokenized","and\/or","featurized","via","NLU","graph","components",",","which","is","why","we","do","n't","care","about","storing","anything","else",".","-","Our","tokenizers","and","featurizers","work","independently","for","each","attribute",",","which","is","why","we","can","separate","them","and","ask","for","``","exactly","one","''","of","the","key","attributes",".","-","Our","tokenizers","add","attributes","(","e.g",".","token","sequences",")","and","not","just","`","Features","`",",","which","is","why","we","need","messages","and","why","we","allow","messages","to","contain","more","than","just","the","key","attributes",".","-","Due","to","the","way","we","use","this","datastructure",",","it","wo","n't","contain","all","features","that","the","policies","need","(","cf",".","`","rasa.core.featurizers.SingleStateFeaturizer","`",")","and","sometimes","the","messages","will","contain","no","features","at","all",",","which","is","the","motivation","for","the","name","of","this","class",".","-","Values","for","different","attributes","might","coincide","(","e.g",".","'greet","'","can","appear","as","user","text","as","well","as","name","of","an","intent",")",",","but","attributes","are","not","all","tokenized","and","featurized","in","the","same","way",",","which","is","why","we","use","the","combination","of","key","attribute","and","value","to","identify","a","message",".","Usage",":","-","At","the","start","of","core","'s","featurization","pipeline",",","we","use","this","container","to","de-duplicate","the","given","story","data","during","training","(","e.g",".","``","Hello","''","might","appear","very","often","but","it","will","end","up","in","the","training","data","only","once",")","and","to","de-duplicate","the","data","given","in","the","tracker","(","e.g",".","if","a","text","appears","repeatedly","in","the","dialogue",",","it","will","only","be","featurized","once","later",")",".","See",":","`","rasa.core.featurizers.precomputation.CoreFeaturizationInputConverter","`",".","-","At","the","end","of","core","'s","featurization","pipeline",",","we","wrap","all","resulting","(","training","data",")","messages","into","this","container","again",".","See",":","`","rasa.core.featurizers.precomputation.CoreFeaturizationCollector","`","."]
code: def __len__(self) -> int:
      return sum(
          len(key_attribute_table)
          for key_attribute_table in self._table.values()
      )
  
imports: from __future__ import annotations
  from typing import Optional, Text, Dict, List, Union, Iterable, Any
  from collections.abc import ValuesView, KeysView
  from rasa.engine.graph import GraphComponent
  from rasa.engine.storage.storage import ModelStorage
  from rasa.engine.storage.resource import Resource
  from rasa.engine.graph import ExecutionContext
  from rasa.shared.core.domain import Domain, SubState
  from rasa.shared.core.events import ActionExecuted, UserUttered, Event
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.shared.core.training_data.structures import StoryGraph
  from rasa.shared.nlu.constants import ACTION_NAME, ACTION_TEXT, INTENT, TEXT
  from rasa.shared.nlu.training_data.message import Message
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.features import Features
  import rasa.shared.utils.io
label_desc: Use image node_id 4 for calling the MessageContainerForCoreFeaturization obj's underlying member method code with example usage: obj.__len__() and returns: sum