Udostępnij przez


BertTokenizer.CreateTokenTypeIdsFromSequences Method

Definition

Overloads

CreateTokenTypeIdsFromSequences(IEnumerable<Int32>, IEnumerable<Int32>)

Create a mask from the two sequences passed to be used in a sequence-pair classification task. A BERT sequence pair mask has the following format: 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 | first sequence | second sequence | If additionalTokenIds is null, this method only returns the first portion of the type ids (0s).

CreateTokenTypeIdsFromSequences(IEnumerable<Int32>, Span<Int32>, Int32, IEnumerable<Int32>)

CreateTokenTypeIdsFromSequences(IEnumerable<Int32>, IEnumerable<Int32>)

Source:
BertTokenizer.cs
Source:
BertTokenizer.cs
Source:
BertTokenizer.cs

Create a mask from the two sequences passed to be used in a sequence-pair classification task. A BERT sequence pair mask has the following format: 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 | first sequence | second sequence | If additionalTokenIds is null, this method only returns the first portion of the type ids (0s).

public System.Collections.Generic.IReadOnlyList<int> CreateTokenTypeIdsFromSequences(System.Collections.Generic.IEnumerable<int> tokenIds, System.Collections.Generic.IEnumerable<int>? additionalTokenIds = default);
member this.CreateTokenTypeIdsFromSequences : seq<int> * seq<int> -> System.Collections.Generic.IReadOnlyList<int>
Public Function CreateTokenTypeIdsFromSequences (tokenIds As IEnumerable(Of Integer), Optional additionalTokenIds As IEnumerable(Of Integer) = Nothing) As IReadOnlyList(Of Integer)

Parameters

tokenIds
IEnumerable<Int32>

List of token IDs for the first sequence.

additionalTokenIds
IEnumerable<Int32>

Optional list of token IDs for the second sequence.

Returns

List of token type IDs according to the given sequence(s).

Exceptions

When tokenIds is null.

Applies to

CreateTokenTypeIdsFromSequences(IEnumerable<Int32>, Span<Int32>, Int32, IEnumerable<Int32>)

Source:
BertTokenizer.cs
Source:
BertTokenizer.cs
Source:
BertTokenizer.cs
public System.Buffers.OperationStatus CreateTokenTypeIdsFromSequences(System.Collections.Generic.IEnumerable<int> tokenIds, Span<int> destination, out int valuesWritten, System.Collections.Generic.IEnumerable<int>? additionalTokenIds = default);
member this.CreateTokenTypeIdsFromSequences : seq<int> * Span<int> * int * seq<int> -> System.Buffers.OperationStatus
Public Function CreateTokenTypeIdsFromSequences (tokenIds As IEnumerable(Of Integer), destination As Span(Of Integer), ByRef valuesWritten As Integer, Optional additionalTokenIds As IEnumerable(Of Integer) = Nothing) As OperationStatus

Parameters

tokenIds
IEnumerable<Int32>
destination
Span<Int32>
valuesWritten
Int32
additionalTokenIds
IEnumerable<Int32>

Returns

Applies to