class_docstr: Collects featurized messages for use by a policy.
class_docstr_tok: ["Collects","featurized","messages","for","use","by","a","policy","."]
docstr: Collects messages.
docstr_tok: ["Collects","messages","."]
code: def collect(
      self, messages: Union[TrainingData, List[Message]]
  ) -> MessageContainerForCoreFeaturization:
      """Collects messages."""
      if isinstance(messages, TrainingData):
          messages = messages.training_examples
      # Note that the input messages had been contained in a lookup table in
      # `StoryToTrainingDataConverter. Hence, we don't need to worry about
      # collisions here anymore.
      container = MessageContainerForCoreFeaturization()
      for message in messages:
          container.add(message)
      return container
  
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 2 for calling the CoreFeaturizationCollector obj's underlying member method code with example usage: obj.collect(messages) and returns: container