text.wordshape

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])>

input_tensor string Tensor with any shape.
pattern A tftext.WordShape or a list of WordShapes.
name A name for the operation (optional).

<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].

ValueError If pattern contains an unknown identifier.