class_docstr: Basic initial tokenization for BERT.  This is run prior to word piece, does
  white space tokenization in addition to lower-casing and accent removal
  if specified.
class_docstr_tok: ["Basic","initial","tokenization","for","BERT",".","This","is","run","prior","to","word","piece",",","does","white","space","tokenization","in","addition","to","lower-casing","and","accent","removal","if","specified","."]
docstr: Tokenizes a piece of text.
docstr_tok: ["Tokenizes","a","piece","of","text","."]
code: def tokenize(self, text):
      """Tokenizes a piece of text."""
      if self.tokenizer.do_lower_case:
          text = self.tokenizer._run_strip_accents(text.lower())
      tokens = self.tokenizer.tokenize(text)
      end = 0
      result = []
      for token in tokens:
          start = text.find(token, end)
          if start == -1:  # safety check, this should not happen
              start = end
          end = start + len(token)
          result.append(Token(token, start, end))
      return result
  
imports: import copy
  import json
  import re
  from collections import OrderedDict
  from typing import List, NamedTuple, Optional, Union
  import torch
  from fairseq.data.encoders.gpt2_bpe import get_encoder
  from fairseq.data.encoders.gpt2_bpe_utils import Encoder
  from pytext.config import ConfigBase
  from pytext.config.component import Component, ComponentType, create_component
  from pytext.data.pickleable_gpt2bpe_encoder import PickleableGPT2BPEEncoder
  from pytext.torchscript.tokenizer import ScriptDoNothingTokenizer, ScriptWordTokenizer
  from pytext.utils.file_io import PathManager
  from pytext.utils.usage import log_class_usage
  from transformers.tokenization_bert import BasicTokenizer, WordpieceTokenizer
label_desc: Use image node_id 3 for calling the BERTInitialTokenizer obj's underlying member method code with example usage: obj.tokenize(text) and returns: result