docstr: Whether the token is the first subword token in a sequence of subword tokens.
  
  This can be used for implementing whole-word masking.
  
  We won't care about the special tokens
  
  Parameters
  ----------
  tokens
  
  Returns
  -------
  ret
docstr_tok: ["Whether","the","token","is","the","first","subword","token","in","a","sequence","of","subword","tokens",".","This","can","be","used","for","implementing","whole-word","masking",".","We","wo","n't","care","about","the","special","tokens","Parameters","--","--","--","--","--","tokens","Returns","--","--","--","-","ret"]
code: def is_first_subword(
      self, tokens: Union[str, int, List[str], List[int]]
  ) -> Union[bool, List[bool]]:
      """Whether the token is the first subword token in a sequence of subword tokens.
  
      This can be used for implementing whole-word masking.
  
      We won't care about the special tokens
  
      Parameters
      ----------
      tokens
  
      Returns
      -------
      ret
      """
      if isinstance(tokens, str):
          return not tokens.startswith(self._wordpieces_prefix)
      elif isinstance(tokens, int):
          return tokens in self._first_subword_id_set
      elif isinstance(tokens, list):
          if len(tokens) == 0:
              return []
          if isinstance(tokens[0], str):
              return [
                  not ele.startswith(self._wordpieces_prefix)
                  for ele in tokens
              ]
          elif isinstance(tokens[0], int):
              return [
                  ele in self._first_subword_id_set for ele in tokens
              ]
          else:
              raise NotImplementedError
      else:
          raise NotImplementedError
  
imports: import os
  import json
  from pkg_resources import parse_version
  from typing import Optional, Union, List, Tuple
  from collections import OrderedDict
  from uuid import uuid4
  from .base import *
  from ..vocab import Vocab, load_vocab
  from ...utils.lazy_imports import try_import_huggingface_tokenizers
label_desc: Use image node_id 2 for calling the HuggingFaceWordPieceTokenizer obj's underlying member method code with example usage: obj.is_first_subword(tokens) and returns: unknown, unknown, list, unknown, unknown