Class TextUtil
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Keras.PreProcessing.Text
Assembly: Keras.dll
Syntax
public class TextUtil : Base, IDisposable
Methods
| Improve this Doc View SourceHashingTrick(String, Int32, String, String, Boolean, String)
Declaration
public static int[] HashingTrick(string text, int n, string hash_function = "", string filters = "!\"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n", bool lower = true, string split = " ")
Parameters
Type | Name | Description |
---|---|---|
System.String | text | |
System.Int32 | n | |
System.String | hash_function | |
System.String | filters | |
System.Boolean | lower | |
System.String | split |
Returns
Type | Description |
---|---|
System.Int32[] |
OneHot(String, Int32, String, Boolean, String)
One-hot encodes a text into a list of word indexes of size n. This is a wrapper to the hashing_trick function using hash as the hashing function; unicity of word to index mapping non-guaranteed.
Declaration
public static int[, ] OneHot(string text, int n, string filters = "!\"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n", bool lower = true, string split = " ")
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text. |
System.Int32 | n | The n. |
System.String | filters | The filters. |
System.Boolean | lower | if set to |
System.String | split | The split. |
Returns
Type | Description |
---|---|
System.Int32[,] |
TextToWordSequence(String, String, Boolean, String)
Texts to word sequence.
Declaration
public static string[] TextToWordSequence(string text, string filters = "!\"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n", bool lower = true, string split = " ")
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text. |
System.String | filters | The filters. |
System.Boolean | lower | if set to |
System.String | split | The split. |
Returns
Type | Description |
---|---|
System.String[] |
Implements
System.IDisposable