![]() |
MyCaffe
1.12.2.41
Deep learning software for Windows C# programmers.
|
The IVocabulary interface specifies the interface that all Vocabularies implement. More...
Public Member Functions | |
| void | Add (string str) |
| Add a new string to the vocabulary. More... | |
| int | Build () |
| Build the vocabulary. More... | |
| int | BuildFromString (string strData) |
| Build the vocabulary from a string. More... | |
| int[] | CreateTarget (int[] rgSrc) |
| Create a target that is offset from the source by one and ends with a EOS. More... | |
| int[] | Tokenize (string str, bool bAddBos, bool bAddEos) |
| Tokenize a string of data. More... | |
| List< int > | Tokenize (string str1, bool bMustExist=true) |
| Tokenize a character into its corresponding index token. More... | |
| string | Detokenize (float[] rgf, bool bIgnoreBos, bool bIgnoreEos) |
| Detokenize an array into a string. More... | |
| string | Detokenize (int nIdxToken, bool bIgnoreBos, bool bIgnoreEos) |
| Detokenize an index token into its corresponding character. More... | |
Properties | |
| int | Count [get] |
| Returns the size of the vocabulary. More... | |
| char | BOS [get] |
| Returns the special BOS character. More... | |
| char | EOS [get] |
| Returns the special EOS character. More... | |
The IVocabulary interface specifies the interface that all Vocabularies implement.
Definition at line 13 of file Interfaces.cs.
| void MyCaffe.layers.gpt.IVocabulary.Add | ( | string | str | ) |
Add a new string to the vocabulary.
| str | Specifies the string to add. |
Implemented in MyCaffe.layers.gpt.VocabularyCharacter, MyCaffe.layers.gpt.VocabularySentencePiece, and MyCaffe.layers.gpt.VocabularyWord.
| int MyCaffe.layers.gpt.IVocabulary.Build | ( | ) |
Build the vocabulary.
Implemented in MyCaffe.layers.gpt.VocabularyCharacter, MyCaffe.layers.gpt.VocabularySentencePiece, and MyCaffe.layers.gpt.VocabularyWord.
| int MyCaffe.layers.gpt.IVocabulary.BuildFromString | ( | string | strData | ) |
Build the vocabulary from a string.
| strData | Specifies the data to build the vocabulary from. |
Implemented in MyCaffe.layers.gpt.VocabularyCharacter, MyCaffe.layers.gpt.VocabularySentencePiece, and MyCaffe.layers.gpt.VocabularyWord.
| int[] MyCaffe.layers.gpt.IVocabulary.CreateTarget | ( | int[] | rgSrc | ) |
Create a target that is offset from the source by one and ends with a EOS.
| rgSrc | Specifies the source to create the target from. |
Implemented in MyCaffe.layers.gpt.VocabularyCharacter, MyCaffe.layers.gpt.VocabularySentencePiece, and MyCaffe.layers.gpt.VocabularyWord.
| string MyCaffe.layers.gpt.IVocabulary.Detokenize | ( | float[] | rgf, |
| bool | bIgnoreBos, | ||
| bool | bIgnoreEos | ||
| ) |
Detokenize an array into a string.
| rgf | Specifies the array of tokens to detokenize. |
| bIgnoreBos | Specifies to ignore the BOS token. |
| bIgnoreEos | Specifies to ignore the EOS token. |
Implemented in MyCaffe.layers.gpt.VocabularyCharacter, MyCaffe.layers.gpt.VocabularySentencePiece, and MyCaffe.layers.gpt.VocabularyWord.
| string MyCaffe.layers.gpt.IVocabulary.Detokenize | ( | int | nIdxToken, |
| bool | bIgnoreBos, | ||
| bool | bIgnoreEos | ||
| ) |
Detokenize an index token into its corresponding character.
| nIdxToken | Specifies the token to detokenize. |
| bIgnoreBos | Specifies to ignore the BOS token. |
| bIgnoreEos | Specifies to ignore the EOS token. |
Implemented in MyCaffe.layers.gpt.VocabularyCharacter, MyCaffe.layers.gpt.VocabularySentencePiece, and MyCaffe.layers.gpt.VocabularyWord.
| int[] MyCaffe.layers.gpt.IVocabulary.Tokenize | ( | string | str, |
| bool | bAddBos, | ||
| bool | bAddEos | ||
| ) |
Tokenize a string of data.
| str | Specifies the string to tokenize. |
| bAddBos | Add the begin of sequence token. |
| bAddEos | Add the end of sequence token. |
Implemented in MyCaffe.layers.gpt.VocabularyCharacter, MyCaffe.layers.gpt.VocabularySentencePiece, and MyCaffe.layers.gpt.VocabularyWord.
| List< int > MyCaffe.layers.gpt.IVocabulary.Tokenize | ( | string | str1, |
| bool | bMustExist = true |
||
| ) |
Tokenize a character into its corresponding index token.
| str1 | Specifies a single element (character or word) to tokenize. |
| bMustExist | Optionally, specifies to throw an error if the item is not in the vocabulary (default = true). |
Implemented in MyCaffe.layers.gpt.VocabularyCharacter, MyCaffe.layers.gpt.VocabularySentencePiece, and MyCaffe.layers.gpt.VocabularyWord.
|
get |
Returns the special BOS character.
Definition at line 22 of file Interfaces.cs.
|
get |
Returns the size of the vocabulary.
Definition at line 18 of file Interfaces.cs.
|
get |
Returns the special EOS character.
Definition at line 26 of file Interfaces.cs.