class_docstr: Builder class for BertExample objects.
class_docstr_tok: ["Builder","class","for","BertExample","objects","."]
docstr: Splits tokens (and the labels accordingly) to WordPieces.
  
  Args:
      tokens: Tokens to be split.
      labels: Labels (one per token) to be split.
  
  Returns:
      3-tuple with the split tokens, split labels, and the indices of starting tokens of words
docstr_tok: ["Splits","tokens","(","and","the","labels","accordingly",")","to","WordPieces",".","Args",":","tokens",":","Tokens","to","be","split",".","labels",":","Labels","(","one","per","token",")","to","be","split",".","Returns",":","3-tuple","with","the","split","tokens",",","split","labels",",","and","the","indices","of","starting","tokens","of","words"]
code: def _split_to_wordpieces_with_labels(
      self, tokens: List[str], labels: List[int]
  ) -> Tuple[List[str], List[int], List[int]]:
      """Splits tokens (and the labels accordingly) to WordPieces.
  
      Args:
          tokens: Tokens to be split.
          labels: Labels (one per token) to be split.
  
      Returns:
          3-tuple with the split tokens, split labels, and the indices of starting tokens of words
      """
      bert_tokens = []  # Original tokens split into wordpieces.
      bert_labels = []  # Label for each wordpiece.
      # Index of each wordpiece that starts a new token.
      token_start_indices = []
      for i, token in enumerate(tokens):
          # '+ 1' is because bert_tokens will be prepended by [CLS] token later.
          token_start_indices.append(len(bert_tokens) + 1)
          pieces = self._tokenizer.tokenize(token)
          bert_tokens.extend(pieces)
          bert_labels.extend([labels[i]] * len(pieces))
      return bert_tokens, bert_labels, token_start_indices
  
file_path: NeMo/nemo/collections/nlp/data/spellchecking_asr_customization/bert_example.py
imports: import logging
  from collections import OrderedDict
  from os import path
  from typing import Dict, List, Optional, Tuple, Union
  from transformers import PreTrainedTokenizerBase
label_desc: Use image node_id 7 for calling the BertExampleBuilder obj's underlying member method code with example usage: obj._split_to_wordpieces_with_labels(tokens, labels) and returns: bert_tokens,  bert_labels,  token_start_indices