code: def _is_punctuation(char: str) -> bool:
      r"""Checks whether `char` is a punctuation character.
  
      Note: this function is not standard and should be considered for BERT
      tokenization only. See the comments for more details.
      """
      cp = ord(char)
      # We treat all non-letter/number ASCII as punctuation.
      # Characters such as "^", "$", and "`" are not in the Unicode
      # Punctuation class but we treat them as punctuation anyways, for
      # consistency.
      if (
          (33 <= cp <= 47)
          or (58 <= cp <= 64)
          or (91 <= cp <= 96)
          or (123 <= cp <= 126)
      ):
          return True
      cat = unicodedata.category(char)
      if cat.startswith("P"):
          return True
      return False
  
file_path: texar/texar/tf/data/tokenizers/bert_tokenizer_utils.py
imports: from typing import Dict, List, Optional
  import collections
  import unicodedata
label_desc: Use image node_id 5 for calling a global function with example usage: _is_punctuation(char) and returns: False, True, True