Tokenizer.Decode 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| Decode(IEnumerable<Int32>) |
將給定的 id 解碼回字串。 |
| Decode(IEnumerable<Int32>, Boolean) |
將給定的 id 解碼回字串。 |
| Decode(Int32, Boolean) |
將 ID 解碼為映射的標記。 |
| Decode(IEnumerable<Int32>, Span<Char>, Int32, Int32) |
將給定的 id 解碼回文字,並將結果儲存在該 |
Decode(IEnumerable<Int32>)
- 來源:
- Tokenizer.cs
- 來源:
- Tokenizer.cs
- 來源:
- Tokenizer.cs
將給定的 id 解碼回字串。
public virtual string Decode(System.Collections.Generic.IEnumerable<int> ids);
abstract member Decode : seq<int> -> string
override this.Decode : seq<int> -> string
Public Overridable Function Decode (ids As IEnumerable(Of Integer)) As String
參數
- ids
- IEnumerable<Int32>
我們想要解碼的 id 清單。
傳回
解碼的字串。
例外狀況
ids 為 null。
ids 包含無效資料。
備註
由 衍生 Tokenizer 出的型別可能會覆寫此實作,以提供更有效率的實作。 預設情況下,它使用 Decode(IEnumerable<Int32>, Span<Char>, Int32, Int32)。
適用於
Decode(IEnumerable<Int32>, Boolean)
將給定的 id 解碼回字串。
public string? Decode(System.Collections.Generic.IEnumerable<int> ids, bool skipSpecialTokens = false);
member this.Decode : seq<int> * bool -> string
Public Function Decode (ids As IEnumerable(Of Integer), Optional skipSpecialTokens As Boolean = false) As String
參數
- ids
- IEnumerable<Int32>
我們想要解碼的 id 清單。
- skipSpecialTokensconsiderSpecialTokens
- Boolean
是否應該從解碼字串中移除特殊標記。
傳回
解碼的字串。
適用於
Decode(Int32, Boolean)
將 ID 解碼為映射的標記。
public string? Decode(int id, bool skipSpecialTokens = false);
member this.Decode : int * bool -> string
Public Function Decode (id As Integer, Optional skipSpecialTokens As Boolean = false) As String
參數
- id
- Int32
ID 是用來映射到代幣的。
- skipSpecialTokensconsiderSpecialTokens
- Boolean
在解碼時,請指示是否要跳過特殊標記。
傳回
解碼後的字串或空,若輸入 id 沒有標記映射。
適用於
Decode(IEnumerable<Int32>, Span<Char>, Int32, Int32)
- 來源:
- Tokenizer.cs
- 來源:
- Tokenizer.cs
- 來源:
- Tokenizer.cs
將給定的 id 解碼回文字,並將結果儲存在該 destination 區間。
public abstract System.Buffers.OperationStatus Decode(System.Collections.Generic.IEnumerable<int> ids, Span<char> destination, out int idsConsumed, out int charsWritten);
abstract member Decode : seq<int> * Span<char> * int * int -> System.Buffers.OperationStatus
Public MustOverride Function Decode (ids As IEnumerable(Of Integer), destination As Span(Of Char), ByRef idsConsumed As Integer, ByRef charsWritten As Integer) As OperationStatus
參數
- ids
- IEnumerable<Int32>
我們想要解碼的 id 清單。
- idsConsumed
- Int32
解碼過程中消耗的 id 數量。
- charsWritten
- Int32
寫入目的地的字元數。
傳回
操作狀態表示所有 ID 是否已成功解碼,或 是否 destination 太小無法包含整個解碼結果。