class_docstr: Prepare text data for the model specified by "prefix". For multiple models requiring text data,
  we need to create a TextProcessor for each related model so that they will have independent input.
class_docstr_tok: ["Prepare","text","data","for","the","model","specified","by","``","prefix","''",".","For","multiple","models","requiring","text","data",",","we","need","to","create","a","TextProcessor","for","each","related","model","so","that","they","will","have","independent","input","."]
docstr: Tokenize a sample's text data and build one token sequence. One sample may have
  multiple text columns in a multimodal pd.DataFrame.
  
  Parameters
  ----------
  text
      The raw text data of one sample.
  
  is_training
      Flag to apply augmentation only to training.
  
  Returns
  -------
  A dictionary containing one sample's text tokens, valid length, and segment ids.
docstr_tok: ["Tokenize","a","sample","'s","text","data","and","build","one","token","sequence",".","One","sample","may","have","multiple","text","columns","in","a","multimodal","pd.DataFrame",".","Parameters","--","--","--","--","--","text","The","raw","text","data","of","one","sample",".","is_training","Flag","to","apply","augmentation","only","to","training",".","Returns","--","--","--","-","A","dictionary","containing","one","sample","'s","text","tokens",",","valid","length",",","and","segment","ids","."]
code: def build_one_token_sequence_from_text(
      self,
      text: Dict[str, str],
      is_training: bool,
  ) -> Dict:
      """
      Tokenize a sample's text data and build one token sequence. One sample may have
      multiple text columns in a multimodal pd.DataFrame.
  
      Parameters
      ----------
      text
          The raw text data of one sample.
  
      is_training
          Flag to apply augmentation only to training.
  
      Returns
      -------
      A dictionary containing one sample's text tokens, valid length, and segment ids.
      """
      # tokenize text
      tokens = {}
      warnings.filterwarnings(
          "ignore",
          "Token indices sequence length is longer than.*result in indexing errors",
      )
  
      if self.template_config.turn_on:
          (
              template,
              applied_template,
          ) = self.template_engine.sample_and_apply_template(text)
          if template:
              answer_choices = template.get_answer_choices_list(text)
              text = {}
              text[TEXT_TOKEN_IDS] = applied_template[0]
              text[CHOICES_IDS] = answer_choices
  
      for col_name, col_text in text.items():
          if is_training:
              if self.train_augmenter is not None:
                  # naive way to detect categorical/numerical text:
                  if (
                      len(col_text.split(" "))
                      >= self.text_detection_length
                  ):
                      col_text = self.train_augmenter(col_text)
          if col_name == CHOICES_IDS:
              answer_ids = self.tokenizer(
                  col_text,
                  padding="max_length",
                  max_length=self.template_engine.get_max_choice_length(
                      self.tokenizer
                  ),
              )["input_ids"]
              tokens[col_name] = answer_ids
              continue
          col_tokens = self.tokenizer.encode(
              col_text,
              add_special_tokens=False,
              truncation=False,
          )
          tokens[col_name] = np.array(col_tokens, dtype=np.int32)
      # build token sequence
      return self.build_one_token_sequence(tokens)
  
imports: import ast
  import logging
  import os
  import warnings
  from copy import deepcopy
  from typing import Any, Dict, List, Optional, Union
  import numpy
  from nptyping import NDArray
  from omegaconf import DictConfig
  from torch import nn
  from ..constants import CHOICES_IDS, COLUMN, TEXT, TEXT_SEGMENT_IDS, TEXT_TOKEN_IDS, TEXT_VALID_LENGTH
  from .collator import PadCollator, StackCollator
  from .template_engine import TemplateEngine
  from .trivial_augmenter import TrivialAugment
  from .utils import extract_value_from_config, get_text_token_max_len, normalize_txt, register_encoding_decoding_error_handlers
label_desc: Use image node_id 9 for calling the TextProcessor obj's underlying member method code with example usage: obj.build_one_token_sequence_from_text(text, is_training) and returns: self