Warning: This API is deprecated and will be removed in a future
version of TensorFlow after
the replacement is stable.
StringNGrams
Stay organized with collections
Save and categorize content based on your preferences.
Creates ngrams from ragged string data.
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.
Public Methods
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)
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.
|
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Methods
public
static
StringNGrams<T>
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.
Parameters
scope |
current scope |
data |
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. |
Returns
- a new instance of StringNGrams
public
Output<String>
ngrams
()
The values tensor of the output ngrams ragged tensor.
public
Output<T>
ngramsSplits
()
The splits tensor of the output ngrams ragged tensor.
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.
Last updated 2022-02-12 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{
"lastModified": "Last updated 2022-02-12 UTC.",
"confidential": False
}