class_docstr: Reduces the features created by a bag of words encoding
code: def fit(
      self,
      X: PIPELINE_DATA_DTYPE,
      y: Optional[PIPELINE_DATA_DTYPE] = None,
  ) -> "TextFeatureReduction":
      if X.shape[1] > self.n_components:
          self.preprocessor = TruncatedSVD(
              n_components=self.n_components,
              random_state=self.random_state,
          )
          self.preprocessor.fit(X)
      elif X.shape[1] <= self.n_components and X.shape[1] != 1:
          self.preprocessor = TruncatedSVD(
              n_components=X.shape[1] - 1,
              random_state=self.random_state,
          )
          self.preprocessor.fit(X)
      elif X.shape[1] == 1:
          self.preprocessor = "passthrough"
      else:
          raise ValueError(
              "The text embedding consists only of a single dimension.\n"
              "Are you sure that your text data is necessary?"
          )
      return self
  
file_path: auto-sklearn/autosklearn/pipeline/components/data_preprocessing/text_feature_reduction/truncated_svd.py
imports: from typing import Dict, Optional, Tuple, Union
  import ConfigSpace.hyperparameters
  import numpy
  from ConfigSpace.configuration_space import ConfigurationSpace
  from sklearn.decomposition import TruncatedSVD
  from autosklearn.askl_typing import FEAT_TYPE_TYPE
  from autosklearn.pipeline.base import DATASET_PROPERTIES_TYPE, PIPELINE_DATA_DTYPE
  from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm
  from autosklearn.pipeline.constants import DENSE, INPUT, SPARSE, UNSIGNED_DATA
label_desc: Use image node_id 2 for calling the TextFeatureReduction obj's underlying member method code with example usage: obj.fit(X, y) and returns: self