code: def wordshape(input_tensor, pattern, name=None):
      r"""Determine wordshape features for each input string.
  
        In this example, we test for title case (the first character is upper or
        title case, and the remaining characters are lowercase).
        >>> input = [
        ... u"abc", u"ABc", u"ABC", u"Abc", u"aBcd", u"\u01c8bc".encode("utf-8")
        ... ]
        >>> wordshape(input, WordShape.HAS_TITLE_CASE)
        <tf.Tensor: shape=(6,), dtype=bool,
         numpy=array([False, False, False,  True, False,  True])>
  
      Args:
        input_tensor: string `Tensor` with any shape.
        pattern: A `tftext.WordShape` or a list of WordShapes.
        name: A name for the operation (optional).
  
      Returns:
        `<bool>[input_tensor.shape + pattern.shape]`: A tensor where
          `result[i1...iN, j]` is true if `input_tensor[i1...iN]` has the wordshape
          specified by `pattern[j]`.
  
      Raises:
        ValueError: If `pattern` contains an unknown identifier.
      """
      if isinstance(pattern, WordShape):
          return string_ops.regex_full_match(
              input_tensor, pattern.value, name
          )
      elif isinstance(pattern, (list, tuple)) and all(
          isinstance(s, WordShape) for s in pattern
      ):
          with ops.name_scope(name, "Wordshape", input_tensor):
              return array_ops_stack.stack(
                  [wordshape(input_tensor, s) for s in pattern], axis=-1
              )
      else:
          raise TypeError(
              "Expected 'pattern' to be a single WordShape or a list of WordShapes."
          )
  
file_path: text/tensorflow_text/python/ops/wordshape_ops.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import enum
  import re
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import string_ops
label_desc: Use image node_id 6 for calling a global function with example usage: wordshape(input_tensor, pattern, name) and returns: string_ops, array_ops_stack