T
- data type for ngramsSplits()
output@Operator public final class StringNGrams<T extends Number> extends PrimitiveOp
This op accepts a ragged tensor with 1 ragged dimension containing only strings and outputs a ragged tensor with 1 ragged dimension containing ngrams of that string, joined along the innermost axis.
operation
Modifier and Type | Method and Description |
---|---|
static <T extends Number> |
create(Scope scope,
Operand<String> data,
Operand<T> dataSplits,
String separator,
List<Long> ngramWidths,
String leftPad,
String rightPad,
Long padWidth,
Boolean preserveShortSequences)
Factory method to create a class wrapping a new StringNGrams operation.
|
Output<String> |
ngrams()
The values tensor of the output ngrams ragged tensor.
|
Output<T> |
ngramsSplits()
The splits tensor of the output ngrams ragged tensor.
|
equals, hashCode, op, toString
public static <T extends Number> StringNGrams<T> create(Scope scope, Operand<String> data, Operand<T> dataSplits, String separator, List<Long> ngramWidths, String leftPad, String rightPad, Long padWidth, Boolean preserveShortSequences)
scope
- current scopedata
- The values tensor of the ragged string tensor to make ngrams out of. Must be a
1D string tensor.dataSplits
- The splits tensor of the ragged string tensor to make ngrams out of.separator
- The string to append between elements of the token. Use "" for no separator.ngramWidths
- The sizes of the ngrams to create.leftPad
- The string to use to pad the left side of the ngram sequence. Only used if
pad_width != 0.rightPad
- The string to use to pad the right side of the ngram sequence. Only used if
pad_width != 0.padWidth
- The number of padding elements to add to each side of each
sequence. Note that padding will never be greater than 'ngram_widths'-1
regardless of this value. If `pad_width=-1`, then add `max(ngram_widths)-1`
elements.preserveShortSequences
- Copyright © 2022. All rights reserved.