tf.strings.unicode_script  |  TensorFlow v2.16.1 (original) (raw)

tf.strings.unicode_script

Stay organized with collections Save and categorize content based on your preferences.

Determine the script codes of a given tensor of Unicode integer code points.

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.strings.unicode_script

tf.strings.unicode_script(
    input: Annotated[Any, _atypes.Int32], name=None
) -> Annotated[Any, _atypes.Int32]

Used in the notebooks

Used in the guide
Unicode strings

This operation converts Unicode code points to script codes corresponding to each code point. Script codes correspond to International Components for Unicode (ICU) UScriptCode values.

SeeICU project docsfor more details on script codes.

For an example, see the unicode strings guide on unicode scripts.

Returns -1 (USCRIPT_INVALID_CODE) for invalid codepoints. Output shape will match input shape.

Examples:

tf.strings.unicode_script([1, 31, 38]) <tf.Tensor: shape=(3,), dtype=int32, numpy=array([0, 0, 0], dtype=int32)>

Args
input A Tensor of type int32. A Tensor of int32 Unicode code points.
name A name for the operation (optional).
Returns
A Tensor of type int32.