code: def get_relevant_data_table(
      text_data: TextData,
      data_type: str,
      columns: Union[Hashable, List[Hashable], None],
      ignore_columns: Union[Hashable, List[Hashable], None],
      n_top_features: Optional[int],
  ):
      """Get relevant data table from the database."""
      if data_type == "metadata":
          relevant_metadata = text_data.metadata[
              text_data.categorical_metadata
              + text_data.numerical_metadata
          ]
          features = select_from_dataframe(
              relevant_metadata, columns, ignore_columns
          )
          cat_features = [
              col
              for col in features.columns
              if col in text_data.categorical_metadata
          ]
  
      elif data_type == "properties":
          features = select_from_dataframe(
              text_data.properties, columns, ignore_columns
          )
          cat_features = [
              col
              for col in features.columns
              if col in text_data.categorical_properties
          ]
      else:
          raise DeepchecksProcessError(
              f"Unknown segment_by value: {data_type}"
          )
  
      if features.shape[1] < 2:
          raise DeepchecksNotSupportedError(
              "Check requires to have at least two "
              f"{data_type} columns in order to run."
          )
  
      if (
          n_top_features is not None
          and n_top_features < features.shape[1]
      ):
          _warn_n_top_columns(data_type, n_top_features)
          features = features.iloc[
              :,
              np.random.choice(
                  features.shape[1], n_top_features, replace=False
              ),
          ]
  
      return features, cat_features
  
file_path: deepchecks/deepchecks/nlp/utils/weak_segments.py
imports: import warnings
  from typing import Hashable, List, Optional, Union
  import numpy
  from deepchecks.core.errors import DeepchecksNotSupportedError, DeepchecksProcessError
  from deepchecks.nlp import TextData
  from deepchecks.utils.dataframes import select_from_dataframe
label_desc: Use image node_id 1 for calling a global function with example usage: get_relevant_data_table(text_data, data_type, columns, ignore_columns, n_top_features) and returns: features,  cat_features