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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-02-12 UTC."],[],[],null,["# StringNGrams\n\npublic final class **StringNGrams** \nCreates ngrams from ragged string data.\n\n\nThis op accepts a ragged tensor with 1 ragged dimension containing only\nstrings and outputs a ragged tensor with 1 ragged dimension containing ngrams\nof that string, joined along the innermost axis.\n\n\u003cbr /\u003e\n\n### Public Methods\n\n|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static \\\u003cT extends Number\\\u003e [StringNGrams](/api_docs/java/org/tensorflow/op/core/StringNGrams)\\\u003cT\\\u003e | [create](/api_docs/java/org/tensorflow/op/core/StringNGrams#create(org.tensorflow.op.Scope,%20org.tensorflow.Operand\u003cjava.lang.String\u003e,%20org.tensorflow.Operand\u003cT\u003e,%20java.lang.String,%20java.util.List\u003cjava.lang.Long\u003e,%20java.lang.String,%20java.lang.String,%20java.lang.Long,%20java.lang.Boolean))([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cString\\\u003e data, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e dataSplits, String separator, List\\\u003cLong\\\u003e ngramWidths, String leftPad, String rightPad, Long padWidth, Boolean preserveShortSequences) Factory method to create a class wrapping a new StringNGrams operation. |\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cString\\\u003e | [ngrams](/api_docs/java/org/tensorflow/op/core/StringNGrams#ngrams())() The values tensor of the output ngrams ragged tensor. |\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e | [ngramsSplits](/api_docs/java/org/tensorflow/op/core/StringNGrams#ngramsSplits())() The splits tensor of the output ngrams ragged tensor. |\n\n### Inherited Methods\n\nFrom class [org.tensorflow.op.PrimitiveOp](/api_docs/java/org/tensorflow/op/PrimitiveOp) \n\n|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| final boolean | [equals](/api_docs/java/org/tensorflow/op/PrimitiveOp#equals(java.lang.Object))(Object obj) |\n| final int | [hashCode](/api_docs/java/org/tensorflow/op/PrimitiveOp#hashCode())() |\n| [Operation](/api_docs/java/org/tensorflow/Operation) | [op](/api_docs/java/org/tensorflow/op/PrimitiveOp#op())() Returns the underlying [Operation](/api_docs/java/org/tensorflow/Operation) |\n| final String | [toString](/api_docs/java/org/tensorflow/op/PrimitiveOp#toString())() |\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public static [StringNGrams](/api_docs/java/org/tensorflow/op/core/StringNGrams)\\\u003cT\\\u003e\n**create**\n([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cString\\\u003e data, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e dataSplits, String separator, List\\\u003cLong\\\u003e ngramWidths, String leftPad, String rightPad, Long padWidth, Boolean preserveShortSequences)\n\nFactory method to create a class wrapping a new StringNGrams operation. \n\n##### Parameters\n\n| scope | current scope |\n| data | The values tensor of the ragged string tensor to make ngrams out of. Must be a 1D string tensor. |\n| dataSplits | The splits tensor of the ragged string tensor to make ngrams out of. |\n| separator | The string to append between elements of the token. Use \"\" for no separator. |\n| ngramWidths | The sizes of the ngrams to create. |\n| leftPad | The string to use to pad the left side of the ngram sequence. Only used if pad_width != 0. |\n| rightPad | The string to use to pad the right side of the ngram sequence. Only used if pad_width != 0. |\n| 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. |\n|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n##### Returns\n\n- a new instance of StringNGrams \n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cString\\\u003e\n**ngrams**\n()\n\nThe values tensor of the output ngrams ragged tensor. \n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e\n**ngramsSplits**\n()\n\nThe splits tensor of the output ngrams ragged tensor."]]