class_docstr: Feature extractor for text classification relying on ngrams tfidf and
  optionally word cooccurrences features
class_docstr_tok: ["Feature","extractor","for","text","classification","relying","on","ngrams","tfidf","and","optionally","word","cooccurrences","features"]
code: def _fit_transform_tfidf_vectorizer(self, x, y, dataset):
      from sklearn.feature_selection import chi2
  
      self.tfidf_vectorizer = TfidfVectorizer(
          config=self.config.tfidf_vectorizer_config,
          builtin_entity_parser=self.builtin_entity_parser,
          custom_entity_parser=self.custom_entity_parser,
          resources=self.resources,
          random_state=self.random_state,
      )
      x_tfidf = self.tfidf_vectorizer.fit_transform(x, dataset)
  
      if not self.tfidf_vectorizer.vocabulary:
          raise _EmptyDatasetUtterancesError(
              "Dataset is empty or with empty utterances"
          )
      _, tfidf_pval = chi2(x_tfidf, y)
      best_tfidf_features = set(
          i
          for i, v in enumerate(tfidf_pval)
          if v < self.config.pvalue_threshold
      )
      if not best_tfidf_features:
          best_tfidf_features = set(
              idx
              for idx, val in enumerate(tfidf_pval)
              if val == tfidf_pval.min()
          )
  
      best_ngrams = [
          ng
          for ng, i in iteritems(self.tfidf_vectorizer.vocabulary)
          if i in best_tfidf_features
      ]
      self.tfidf_vectorizer.limit_vocabulary(best_ngrams)
      # We can't return x_tfidf[:best_tfidf_features] because of the
      # normalization in the transform of the tfidf_vectorizer
      # this would lead to inconsistent result between: fit_transform(x, y)
      # and fit(x, y).transform(x)
      return self.tfidf_vectorizer.transform(x)
  
imports: from __future__ import division, unicode_literals
  import json
  from builtins import str, zip
  from copy import deepcopy
  from pathlib import Path
  from future.utils import iteritems
  from snips_nlu.common.utils import json_string, fitted_required, replace_entities_with_placeholders, check_persisted_path
  from snips_nlu.constants import DATA, ENTITY, ENTITY_KIND, LANGUAGE, NGRAM, TEXT, ENTITIES
  from snips_nlu.dataset import get_text_from_chunks, validate_and_format_dataset
  from snips_nlu.entity_parser.builtin_entity_parser import is_builtin_entity
  from snips_nlu.exceptions import _EmptyDatasetUtterancesError, LoadingError
  from snips_nlu.languages import get_default_sep
  from snips_nlu.pipeline.configs import FeaturizerConfig
  from snips_nlu.pipeline.configs.intent_classifier import CooccurrenceVectorizerConfig, TfidfVectorizerConfig
  from snips_nlu.pipeline.processing_unit import ProcessingUnit
  from snips_nlu.preprocessing import stem, tokenize_light
  from snips_nlu.resources import get_stop_words, get_word_cluster
  from snips_nlu.slot_filler.features_utils import get_all_ngrams
label_desc: Use image node_id 7 for calling the Featurizer obj's underlying member method code with example usage: obj._fit_transform_tfidf_vectorizer(x, y, dataset) and returns: self