Tokenizer.GetIndexByTokenCount Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Surcharges
| Nom | Description |
|---|---|
| GetIndexByTokenCount(ReadOnlySpan<Char>, Int32, String, Int32, Boolean, Boolean) |
Recherchez l’index de la capacité d’encodage maximale sans dépasser la limite de jetons. |
| GetIndexByTokenCount(String, Int32, String, Int32, Boolean, Boolean) |
Recherchez l’index de la capacité d’encodage maximale sans dépasser la limite de jetons. |
| GetIndexByTokenCount(String, ReadOnlySpan<Char>, EncodeSettings, Boolean, String, Int32) |
Recherchez l’index de la capacité d’encodage maximale sans dépasser la limite de jetons. |
GetIndexByTokenCount(ReadOnlySpan<Char>, Int32, String, Int32, Boolean, Boolean)
- Source:
- Tokenizer.cs
- Source:
- Tokenizer.cs
- Source:
- Tokenizer.cs
Recherchez l’index de la capacité d’encodage maximale sans dépasser la limite de jetons.
public int GetIndexByTokenCount(ReadOnlySpan<char> text, int maxTokenCount, out string? normalizedText, out int tokenCount, bool considerPreTokenization = true, bool considerNormalization = true);
member this.GetIndexByTokenCount : ReadOnlySpan<char> * int * string * int * bool * bool -> int
Public Function GetIndexByTokenCount (text As ReadOnlySpan(Of Char), maxTokenCount As Integer, ByRef normalizedText As String, ByRef tokenCount As Integer, Optional considerPreTokenization As Boolean = true, Optional considerNormalization As Boolean = true) As Integer
Paramètres
- text
- ReadOnlySpan<Char>
Texte à encoder.
- maxTokenCount
- Int32
Nombre maximal de jetons à encoder.
- normalizedText
- String
Si la normalisation du tokenizer est activée ou <si le nom paramRef="considerPreTokenization"></paramRef est >défini falsesur paramRef< name="text"></paramRef> dans sa forme normalisée ; sinon, cette valeur est définie nullsur .
- tokenCount
- Int32
Le nombre de jetons peut être généré, qui doit être inférieur au nombre maximal de jetons.
- considerPreTokenization
- Boolean
Indiquez s’il faut envisager la pré-tokenisation avant la tokenisation.
- considerNormalization
- Boolean
Indiquez s’il faut envisager la normalisation avant la tokenisation.
Retours
Index de la capacité d’encodage maximale dans le texte traité sans dépasser la limite de jetons.
Il représente l’index immédiatement après le dernier caractère à inclure. Dans les cas où aucun jeton n’est adapté, le résultat est 0 ; inversement, si tous les jetons conviennent, le résultat sera de longueur du texte d’entrée ou de la normalizedText normalisation si la normalisation est activée.
S’applique à
GetIndexByTokenCount(String, Int32, String, Int32, Boolean, Boolean)
- Source:
- Tokenizer.cs
- Source:
- Tokenizer.cs
- Source:
- Tokenizer.cs
Recherchez l’index de la capacité d’encodage maximale sans dépasser la limite de jetons.
public int GetIndexByTokenCount(string text, int maxTokenCount, out string? normalizedText, out int tokenCount, bool considerPreTokenization = true, bool considerNormalization = true);
member this.GetIndexByTokenCount : string * int * string * int * bool * bool -> int
Public Function GetIndexByTokenCount (text As String, maxTokenCount As Integer, ByRef normalizedText As String, ByRef tokenCount As Integer, Optional considerPreTokenization As Boolean = true, Optional considerNormalization As Boolean = true) As Integer
Paramètres
- text
- String
Texte à encoder.
- maxTokenCount
- Int32
Nombre maximal de jetons à encoder.
- normalizedText
- String
Si la normalisation du tokenizer est activée ou <si le nom paramRef="considerNormalization"></paramRef est >défini falsesur paramRef< name="text"></paramRef> dans sa forme normalisée ; sinon, cette valeur est définie nullsur .
- tokenCount
- Int32
Le nombre de jetons peut être généré, qui doit être inférieur au nombre maximal de jetons.
- considerPreTokenization
- Boolean
Indiquez s’il faut envisager la pré-tokenisation avant la tokenisation.
- considerNormalization
- Boolean
Indiquez s’il faut envisager la normalisation avant la tokenisation.
Retours
Index de la capacité d’encodage maximale dans le texte traité sans dépasser la limite de jetons.
Il représente l’index immédiatement après le dernier caractère à inclure. Dans les cas où aucun jeton n’est adapté, le résultat est 0 ; inversement, si tous les jetons conviennent, le résultat sera de longueur du texte d’entrée ou de la normalizedText normalisation si la normalisation est activée.
S’applique à
GetIndexByTokenCount(String, ReadOnlySpan<Char>, EncodeSettings, Boolean, String, Int32)
- Source:
- Tokenizer.cs
- Source:
- Tokenizer.cs
- Source:
- Tokenizer.cs
Recherchez l’index de la capacité d’encodage maximale sans dépasser la limite de jetons.
protected virtual int GetIndexByTokenCount(string? text, ReadOnlySpan<char> textSpan, Microsoft.ML.Tokenizers.EncodeSettings settings, bool fromEnd, out string? normalizedText, out int tokenCount);
abstract member GetIndexByTokenCount : string * ReadOnlySpan<char> * Microsoft.ML.Tokenizers.EncodeSettings * bool * string * int -> int
override this.GetIndexByTokenCount : string * ReadOnlySpan<char> * Microsoft.ML.Tokenizers.EncodeSettings * bool * string * int -> int
Protected Overridable Function GetIndexByTokenCount (text As String, textSpan As ReadOnlySpan(Of Char), settings As EncodeSettings, fromEnd As Boolean, ByRef normalizedText As String, ByRef tokenCount As Integer) As Integer
Paramètres
- text
- String
Texte à encoder.
- textSpan
- ReadOnlySpan<Char>
Étendue du texte à encoder, qui sera utilisée si la valeur text est null.
- settings
- EncodeSettings
Paramètres utilisés pour encoder le texte.
- fromEnd
- Boolean
Indiquez s’il faut rechercher l’index à partir de la fin du texte.
- normalizedText
- String
Si la normalisation du tokenizer est activée ou <si le nom paramRef="settings"></paramRef est >ConsiderNormalizationdéfini falsesur paramRef< name="text"></paramRef> dans sa forme normalisée ; sinon, cette valeur est définie nullsur .
- tokenCount
- Int32
Le nombre de jetons peut être généré, qui doit être inférieur au nombre maximal de jetons.
Retours
Index de la capacité d’encodage maximale dans le texte traité sans dépasser la limite de jetons.
Si <paramRef name="fromEnd"></paramRef> est false, il représente l’index immédiatement après le dernier caractère à inclure. Dans les cas où aucun jeton n’est adapté, le résultat est 0 ; inversement, si tous les jetons conviennent, le résultat sera de longueur du texte d’entrée ou de la normalizedText normalisation si la normalisation est activée.
Si <paramRef name="fromEnd"></paramRef> est true, il représente l’index du premier caractère à inclure. Dans les cas où aucun jeton n’est adapté, le résultat sera la longueur du texte ; inversement, si tous les jetons conviennent, le résultat est égal à zéro.
Remarques
Les types dérivés de Tokenizer cette implémentation peuvent remplacer cette implémentation pour fournir une implémentation plus efficace. Par défaut, il utilise EncodeToTokens(String, ReadOnlySpan<Char>, EncodeSettings).