docstr: Whether the token is the last subword token. This can be used for whole-word masking.
  
  Parameters
  ----------
  tokens
      The input tokens
  
  Returns
  -------
  ret
      Whether the token is the last subword token in the list of subwords.
docstr_tok: ["Whether","the","token","is","the","last","subword","token",".","This","can","be","used","for","whole-word","masking",".","Parameters","--","--","--","--","--","tokens","The","input","tokens","Returns","--","--","--","-","ret","Whether","the","token","is","the","last","subword","token","in","the","list","of","subwords","."]
code: def is_last_subword(
      self, tokens: Union[str, int, List[str], List[int]]
  ) -> Union[bool, List[bool]]:
      """Whether the token is the last subword token. This can be used for whole-word masking.
  
      Parameters
      ----------
      tokens
          The input tokens
  
      Returns
      -------
      ret
          Whether the token is the last subword token in the list of subwords.
      """
      if isinstance(tokens, str):
          return tokens.endswith(self._suffix)
      elif isinstance(tokens, int):
          return tokens in self._last_subword_id_set
      elif isinstance(tokens, list):
          if len(tokens) == 0:
              return []
          if isinstance(tokens[0], str):
              return [ele.endswith(self._suffix) for ele in tokens]
          elif isinstance(tokens[0], int):
              return [
                  ele in self._last_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 HuggingFaceBPETokenizer obj's underlying member method code with example usage: obj.is_last_subword(tokens) and returns: tokens, unknown, list, unknown, unknown