tf.strings.split

Split elements of input based on sep into a RaggedTensor.

Used in the notebooks

Used in the guide Used in the tutorials

Let N be the size of input (typically N will be the batch size). Split each element of input based on sep and return a RaggedTensor containing the split tokens. Empty tokens are ignored.

Example:

tf.strings.split('hello world').numpy()
 array([b'hello', b'world'], dtype=object)
tf.strings.split(['hello world', 'a b c'])
<tf.RaggedTensor [[b'hello', b'world'], [b'a', b'b', b'c']]>

If sep is given, consecutive del