class_docstr: `FeatureConnector` for text, encoding to integers with a `TextEncoder`.
docstr: Constructs a Text FeatureConnector.
  
  Args:
    encoder: `tfds.deprecated.text.TextEncoder`, an encoder that can convert
      text to integers. If None, the text will be utf-8 byte-encoded.
    encoder_config: `tfds.deprecated.text.TextEncoderConfig`, needed if
      restoring from a file with `load_metadata`.
    doc: Documentation of this feature (e.g. description).
docstr_tok: ["Constructs","a","Text","FeatureConnector",".","Args",":","encoder",":","`","tfds.deprecated.text.TextEncoder","`",",","an","encoder","that","can","convert","text","to","integers",".","If","None",",","the","text","will","be","utf-8","byte-encoded",".","encoder_config",":","`","tfds.deprecated.text.TextEncoderConfig","`",",","needed","if","restoring","from","a","file","with","`","load_metadata","`",".","doc",":","Documentation","of","this","feature","(","e.g",".","description",")","."]
code: def __init__(
      self,
      encoder=None,
      encoder_config=None,
      *,
      doc: feature_lib.DocArg = None,
  ):
      """Constructs a Text FeatureConnector.
  
      Args:
        encoder: `tfds.deprecated.text.TextEncoder`, an encoder that can convert
          text to integers. If None, the text will be utf-8 byte-encoded.
        encoder_config: `tfds.deprecated.text.TextEncoderConfig`, needed if
          restoring from a file with `load_metadata`.
        doc: Documentation of this feature (e.g. description).
      """
      if encoder and encoder_config:
          raise ValueError(
              "If encoder is provided, encoder_config must be None."
          )
      if encoder:
          encoder_config = text_lib.TextEncoderConfig(
              encoder_cls=type(encoder), vocab_size=encoder.vocab_size
          )
      elif encoder_config:
          encoder = encoder_config.encoder
  
      self._encoder = encoder
      self._encoder_config = encoder_config
  
      has_encoder = bool(encoder or self._encoder_cls)
      if has_encoder:
          logging.warning(
              "TFDS datasets with text encoding are deprecated and will be removed "
              "in a future version. Instead, you should use the plain text version "
              "and tokenize the text using `tensorflow_text` (See: "
              "https://www.tensorflow.org/tutorials/tensorflow_text/intro#tfdata_example)"
          )
      super(Text, self).__init__(
          shape=(None,) if has_encoder else (),
          dtype=np.int64 if has_encoder else np.object_,
          doc=doc,
      )
  
imports: import html
  import os
  import textwrap
  from typing import Union
  from absl import logging
  from etils import epath
  import numpy
  from tensorflow_datasets.core.deprecated import text
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.features import tensor_feature
  from tensorflow_datasets.core.proto import feature_pb2
  from tensorflow_datasets.core.utils import type_utils
label_desc: Use image node_id 1 to create a new Text object from inherited base classes: tensor_feature with example: obj = Text(encoder, encoder_config)