语言

Tokenizer.Decode 方法

定义

重载

名称 说明
Decode(IEnumerable<Int32>)

将给定 ID 解码回字符串。

Decode(IEnumerable<Int32>, Boolean)

将给定 ID 解码回字符串。

Decode(Int32, Boolean)

将 ID 解码为映射的令牌。

Decode(IEnumerable<Int32>, Span<Char>, Int32, Int32)

将给定 ID 解码回文本,并将结果存储在范围中 destination 。

Decode(IEnumerable<Int32>)

Source:
Tokenizer.cs
Source:
Tokenizer.cs
Source:
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 的令牌,则为解码的字符串或 null。

适用于

Decode(IEnumerable<Int32>, Span<Char>, Int32, Int32)

Source:
Tokenizer.cs
Source:
Tokenizer.cs
Source:
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 列表。

destination
Span<Char>

用于存储解码文本的范围。

idsConsumed
Int32

解码期间使用的 ID 数。

charsWritten
Int32

写入目标范围的字符数。

返回

操作状态指示是否已成功解码所有 ID,或者 destination 是否太小而无法包含整个解码结果。

适用于