docstr: Trains the component from training data.
docstr_tok: ["Trains","the","component","from","training","data","."]
code: def train(self, training_data: TrainingData) -> Resource:
      """Trains the component from training data."""
      texts = [
          e.get(TEXT)
          for e in training_data.training_examples
          if e.get(TEXT)
      ]
      self.tfm.fit(texts)
      self.persist()
      return self._resource
  
imports: import logging
  from typing import Any, Text, Dict, List, Type
  from sklearn.feature_extraction.text import TfidfVectorizer
  from rasa.engine.recipes.default_recipe import DefaultV1Recipe
  from rasa.engine.graph import ExecutionContext, GraphComponent
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.nlu.featurizers.sparse_featurizer.sparse_featurizer import SparseFeaturizer
  from rasa.nlu.tokenizers.tokenizer import Tokenizer
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.features import Features
  from rasa.shared.nlu.training_data.message import Message
  from rasa.nlu.constants import DENSE_FEATURIZABLE_ATTRIBUTES, FEATURIZER_CLASS_ALIAS
  from joblib import dump, load
  from rasa.shared.nlu.constants import TEXT, TEXT_TOKENS, FEATURE_TYPE_SENTENCE, FEATURE_TYPE_SEQUENCE
label_desc: Use image node_id 5 for calling the TfIdfFeaturizer obj's underlying member method code with example usage: obj.train(training_data) and returns: self