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.
tf.strings.unicode_script(
input: Annotated[Any, _atypes.Int32], name=None
) -> Annotated[Any, _atypes.Int32]
Used in the notebooks
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.
See
ICU project docs
for 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 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.strings.unicode_script\n\n\u003cbr /\u003e\n\nDetermine the script codes of a given tensor of Unicode integer code points.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.strings.unicode_script`](https://www.tensorflow.org/api_docs/python/tf/strings/unicode_script)\n\n\u003cbr /\u003e\n\n tf.strings.unicode_script(\n input: Annotated[Any, _atypes.Int32], name=None\n ) -\u003e Annotated[Any, _atypes.Int32]\n\n### Used in the notebooks\n\n| Used in the guide |\n|--------------------------------------------------------------------|\n| - [Unicode strings](https://www.tensorflow.org/text/guide/unicode) |\n\nThis operation converts Unicode code points to script codes corresponding to\neach code point. Script codes correspond to International Components for\nUnicode (ICU) UScriptCode values.\n\nSee\n[ICU project docs](http://icu-project.org/apiref/icu4c/uscript_8h.html)\nfor more details on script codes.\n\nFor an example, see the unicode strings guide on [unicode scripts](https://www.tensorflow.org/tutorials/load_data/unicode#representing_unicode).\n\nReturns -1 (USCRIPT_INVALID_CODE) for invalid codepoints. Output shape will\nmatch input shape.\n\n#### Examples:\n\n tf.strings.unicode_script([1, 31, 38])\n \u003ctf.Tensor: shape=(3,), dtype=int32, numpy=array([0, 0, 0], dtype=int32)\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|--------------------------------------------------------------------|\n| `input` | A `Tensor` of type `int32`. A Tensor of int32 Unicode code points. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` of type `int32`. ||\n\n\u003cbr /\u003e"]]