class_docstr: Creates dataset to use during inference for punctuation and capitalization tasks with a pretrained model.
  For dataset to use during training with labels, see
  :class:`~nemo.collections.nlp.data.token_classification.punctuation_capitalization_dataset.BertPunctuationCapitalizationDataset`
  and
  :class:`~nemo.collections.nlp.data.token_classification.punctuation_capitalization_tarred_dataset.BertPunctuationCapitalizationTarredDataset`.
  
  Parameters ``max_seq_length``, ``step``, ``margin`` are for controlling the way queries are split into segments
  which then processed by the model. Parameter ``max_seq_length`` is a length of a segment after tokenization
  including special tokens [CLS] in the beginning and [SEP] in the end of a segment. Parameter ``step`` is shift
  between consequent segments. Parameter ``margin`` is used to exclude negative effect of subtokens near
  borders of segments which have only one side context.
  
  Args:
      queries (:obj:`List[str]`): list of sequences.
      tokenizer (:obj:`TokenizerSpec`): a tokenizer which was used for model training. It should have properties
          ``cls_id``, ``sep_id``, ``unk_id``, ``pad_id``.
      max_seq_length (:obj:`int`, `optional`, defaults to :obj:`128`): max sequence length which includes [CLS] and
          [SEP] tokens
      step (:obj:`int`, `optional`, defaults to :obj:`8`): relative shift of consequent segments into which long
          queries are split. Long queries are split into segments which can overlap. Parameter ``step`` controls such
          overlapping. Imagine that queries are tokenized into characters, ``max_seq_length=5``, and ``step=2``. In
          such a case query "hello" is tokenized into segments
          ``[['[CLS]', 'h', 'e', 'l', '[SEP]'], ['[CLS]', 'l', 'l', 'o', '[SEP]']]``.
      margin (:obj:`int`, `optional`, defaults to :obj:`16`): number of subtokens in the beginning and the end of
          segments which are not used for prediction computation. The first segment does not have left margin and the
          last segment does not have right margin. For example, if input sequence is tokenized into characters,
          ``max_seq_length=5``, ``step=1``, and ``margin=1``, then query "hello" will be tokenized into segments
          ``[['[CLS]', 'h', 'e', 'l', '[SEP]'], ['[CLS]', 'e', 'l', 'l', '[SEP]'],
          ['[CLS]', 'l', 'l', 'o', '[SEP]']]``. These segments are passed to the model. Before final predictions
          computation, margins are removed. In the next list, subtokens which logits are not used for final
          predictions computation are marked with asterisk: ``[['[CLS]'*, 'h', 'e', 'l'*, '[SEP]'*],
          ['[CLS]'*, 'e'*, 'l', 'l'*, '[SEP]'*], ['[CLS]'*, 'l'*, 'l', 'o', '[SEP]'*]]``.
class_docstr_tok: ["Creates","dataset","to","use","during","inference","for","punctuation","and","capitalization","tasks","with","a","pretrained","model",".","For","dataset","to","use","during","training","with","labels",",","see",":","class",":","`","~nemo.collections.nlp.data.token_classification.punctuation_capitalization_dataset.BertPunctuationCapitalizationDataset","`","and",":","class",":","`","~nemo.collections.nlp.data.token_classification.punctuation_capitalization_tarred_dataset.BertPunctuationCapitalizationTarredDataset","`",".","Parameters","``","max_seq_length","``",",","``","step","``",",","``","margin","``","are","for","controlling","the","way","queries","are","split","into","segments","which","then","processed","by","the","model",".","Parameter","``","max_seq_length","``","is","a","length","of","a","segment","after","tokenization","including","special","tokens","[","CLS","]","in","the","beginning","and","[","SEP","]","in","the","end","of","a","segment",".","Parameter","``","step","``","is","shift","between","consequent","segments",".","Parameter","``","margin","``","is","used","to","exclude","negative","effect","of","subtokens","near","borders","of","segments","which","have","only","one","side","context",".","Args",":","queries","(",":","obj",":","`","List","[","str","]","`",")",":","list","of","sequences",".","tokenizer","(",":","obj",":","`","TokenizerSpec","`",")",":","a","tokenizer","which","was","used","for","model","training",".","It","should","have","properties","``","cls_id","``",",","``","sep_id","``",",","``","unk_id","``",",","``","pad_id","``",".","max_seq_length","(",":","obj",":","`","int","`",",","`","optional","`",",","defaults","to",":","obj",":","`","128","`",")",":","max","sequence","length","which","includes","[","CLS","]","and","[","SEP","]","tokens","step","(",":","obj",":","`","int","`",",","`","optional","`",",","defaults","to",":","obj",":","`","8","`",")",":","relative","shift","of","consequent","segments","into","which","long","queries","are","split",".","Long","queries","are","split","into","segments","which","can","overlap",".","Parameter","``","step","``","controls","such","overlapping",".","Imagine","that","queries","are","tokenized","into","characters",",","``","max_seq_length=5","``",",","and","``","step=2","``",".","In","such","a","case","query","``","hello","''","is","tokenized","into","segments","``","[","[","'","[","CLS","]","'",",","'","h","'",",","'","e","'",",","'","l","'",",","'","[","SEP","]","'","]",",","[","'","[","CLS","]","'",",","'","l","'",",","'","l","'",",","'","o","'",",","'","[","SEP","]","'","]","]","``",".","margin","(",":","obj",":","`","int","`",",","`","optional","`",",","defaults","to",":","obj",":","`","16","`",")",":","number","of","subtokens","in","the","beginning","and","the","end","of","segments","which","are","not","used","for","prediction","computation",".","The","first","segment","does","not","have","left","margin","and","the","last","segment","does","not","have","right","margin",".","For","example",",","if","input","sequence","is","tokenized","into","characters",",","``","max_seq_length=5","``",",","``","step=1","``",",","and","``","margin=1","``",",","then","query","``","hello","''","will","be","tokenized","into","segments","``","[","[","'","[","CLS","]","'",",","'","h","'",",","'","e","'",",","'","l","'",",","'","[","SEP","]","'","]",",","[","'","[","CLS","]","'",",","'","e","'",",","'","l","'",",","'","l","'",",","'","[","SEP","]","'","]",",","[","'","[","CLS","]","'",",","'","l","'",",","'","l","'",",","'","o","'",",","'","[","SEP","]","'","]","]","``",".","These","segments","are","passed","to","the","model",".","Before","final","predictions","computation",",","margins","are","removed",".","In","the","next","list",",","subtokens","which","logits","are","not","used","for","final","predictions","computation","are","marked","with","asterisk",":","``","[","[","'","[","CLS","]","'","*",",","'","h","'",",","'","e","'",",","'","l","'","*",",","'","[","SEP","]","'","*","]",",","[","'","[","CLS","]","'","*",",","'","e","'","*",",","'","l","'",",","'","l","'","*",",","'","[","SEP","]","'","*","]",",","[","'","[","CLS","]","'","*",",","'","l","'","*",",","'","l","'",",","'","o","'",",","'","[","SEP","]","'","*","]","]","``","."]
code: def __len__(self) -> int:
      return len(self.all_input_ids)
  
imports: import io
  import itertools
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from numpy import ndarray
  from torch import Tensor
  from torch.nn.utils.rnn import pad_sequence
  from nemo.collections.common.tokenizers import TokenizerSpec
  from nemo.collections.nlp.data import get_stats
  from nemo.core import Dataset
  from nemo.core.neural_types import ChannelType, Index, MaskType, NeuralType
  from nemo.core.neural_types.elements import AudioSignal, BoolType, LengthsType
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the BertPunctuationCapitalizationInferDataset obj's underlying member method code with example usage: obj.__len__() and returns: len