class_docstr: Customtokenizer which will tokenize the input text as words or phases and convert the words (str) to an index (int) using the vocab.
  If you would like tokens, please use `hub.BertTokenizer`.
docstr: Truncates a sequence pair in place to the maximum length.
  Args:
      ids: list of tokenized input ids. Can be obtained from a string by chaining the
          `tokenize` and `convert_tokens_to_ids` methods.
      pair_ids: Optional second list of input ids. Can be obtained from a string by chaining the
          `tokenize` and `convert_tokens_to_ids` methods.
      num_tokens_to_remove (:obj:`int`, `optional`, defaults to ``0``):
          number of tokens to remove using the truncation strategy
      truncation_strategy: string selected in the following options:
          - 'longest_first' (default) Iteratively reduce the inputs sequence until the input is under max_seq_len
              starting from the longest one at each token (when there is a pair of input sequences).
              Overflowing tokens only contains overflow from the first sequence.
          - 'only_first': Only truncate the first sequence. raise an error if the first sequence is shorter or equal to than num_tokens_to_remove.
          - 'only_second': Only truncate the second sequence
          - 'do_not_truncate': Does not truncate (raise an error if the input sequence is longer than max_seq_len)
      stride (:obj:`int`, `optional`, defaults to ``0``):
          If set to a number along with max_seq_len, the overflowing tokens returned will contain some tokens
          from the main sequence returned. The value of this argument defines the number of additional tokens.
docstr_tok: ["Truncates","a","sequence","pair","in","place","to","the","maximum","length",".","Args",":","ids",":","list","of","tokenized","input","ids",".","Can","be","obtained","from","a","string","by","chaining","the","`","tokenize","`","and","`","convert_tokens_to_ids","`","methods",".","pair_ids",":","Optional","second","list","of","input","ids",".","Can","be","obtained","from","a","string","by","chaining","the","`","tokenize","`","and","`","convert_tokens_to_ids","`","methods",".","num_tokens_to_remove","(",":","obj",":","`","int","`",",","`","optional","`",",","defaults","to","``","0","``",")",":","number","of","tokens","to","remove","using","the","truncation","strategy","truncation_strategy",":","string","selected","in","the","following","options",":","-","'longest_first","'","(","default",")","Iteratively","reduce","the","inputs","sequence","until","the","input","is","under","max_seq_len","starting","from","the","longest","one","at","each","token","(","when","there","is","a","pair","of","input","sequences",")",".","Overflowing","tokens","only","contains","overflow","from","the","first","sequence",".","-","'only_first","'",":","Only","truncate","the","first","sequence",".","raise","an","error","if","the","first","sequence","is","shorter","or","equal","to","than","num_tokens_to_remove",".","-","'only_second","'",":","Only","truncate","the","second","sequence","-","'do_not_truncate","'",":","Does","not","truncate","(","raise","an","error","if","the","input","sequence","is","longer","than","max_seq_len",")","stride","(",":","obj",":","`","int","`",",","`","optional","`",",","defaults","to","``","0","``",")",":","If","set","to","a","number","along","with","max_seq_len",",","the","overflowing","tokens","returned","will","contain","some","tokens","from","the","main","sequence","returned",".","The","value","of","this","argument","defines","the","number","of","additional","tokens","."]
code: def truncate_sequences(
      self,
      ids: List[int],
      pair_ids: List[int] = None,
      num_tokens_to_remove: int = 0,
      truncation_strategy: str = "longest_first",
      stride: int = 0,
  ):
      """Truncates a sequence pair in place to the maximum length.
      Args:
          ids: list of tokenized input ids. Can be obtained from a string by chaining the
              `tokenize` and `convert_tokens_to_ids` methods.
          pair_ids: Optional second list of input ids. Can be obtained from a string by chaining the
              `tokenize` and `convert_tokens_to_ids` methods.
          num_tokens_to_remove (:obj:`int`, `optional`, defaults to ``0``):
              number of tokens to remove using the truncation strategy
          truncation_strategy: string selected in the following options:
              - 'longest_first' (default) Iteratively reduce the inputs sequence until the input is under max_seq_len
                  starting from the longest one at each token (when there is a pair of input sequences).
                  Overflowing tokens only contains overflow from the first sequence.
              - 'only_first': Only truncate the first sequence. raise an error if the first sequence is shorter or equal to than num_tokens_to_remove.
              - 'only_second': Only truncate the second sequence
              - 'do_not_truncate': Does not truncate (raise an error if the input sequence is longer than max_seq_len)
          stride (:obj:`int`, `optional`, defaults to ``0``):
              If set to a number along with max_seq_len, the overflowing tokens returned will contain some tokens
              from the main sequence returned. The value of this argument defines the number of additional tokens.
      """
      if num_tokens_to_remove <= 0:
          return ids, pair_ids, []
  
      if truncation_strategy == "longest_first":
          overflowing_tokens = []
          for _ in range(num_tokens_to_remove):
              if pair_ids is None or len(ids) > len(pair_ids):
                  overflowing_tokens = [ids[-1]] + overflowing_tokens
                  ids = ids[:-1]
              else:
                  pair_ids = pair_ids[:-1]
          window_len = min(len(ids), stride)
          if window_len > 0:
              overflowing_tokens = (
                  ids[-window_len:] + overflowing_tokens
              )
      elif truncation_strategy == "only_first":
          assert len(ids) > num_tokens_to_remove
          window_len = min(len(ids), stride + num_tokens_to_remove)
          overflowing_tokens = ids[-window_len:]
          ids = ids[:-num_tokens_to_remove]
      elif truncation_strategy == "only_second":
          assert (
              pair_ids is not None
              and len(pair_ids) > num_tokens_to_remove
          )
          window_len = min(len(pair_ids), stride + num_tokens_to_remove)
          overflowing_tokens = pair_ids[-window_len:]
          pair_ids = pair_ids[:-num_tokens_to_remove]
      elif truncation_strategy == "do_not_truncate":
          raise ValueError(
              "Input sequence are too long for max_seq_len. Please select a truncation strategy."
          )
      else:
          raise ValueError(
              "Truncation_strategy should be selected in ['longest_first', 'only_first', 'only_second', 'do_not_truncate']"
          )
      return (ids, pair_ids, overflowing_tokens)
  
imports: import collections
  import inspect
  import os
  from typing import Callable, List, Union
  import paddlehub
  from paddlehub.utils.log import logger
  from paddlehub.text.bert_tokenizer import BasicTokenizer
  from paddlehub.text.utils import load_vocab, whitespace_tokenize
label_desc: Use image node_id 11 for calling the CustomTokenizer obj's underlying member method code with example usage: obj.truncate_sequences(ids, pair_ids, num_tokens_to_remove, truncation_strategy, stride) and returns: ids,  pair_ids,  overflowing_tokens, ids,  pair_ids,  list