1 write to _vocab
Microsoft.ML.Tokenizers (1)
Model\BPETokenizer.cs (1)
231
_vocab
= vocab ?? new Dictionary<StringSpanOrdinalKey, int>();
10 references to _vocab
Microsoft.ML.Tokenizers (10)
Model\BPETokenizer.cs (10)
59
if (!
_vocab
.TryGetValue(value, out int id))
236
foreach (KeyValuePair<StringSpanOrdinalKey, int> kvp in
_vocab
)
257
if (!
_vocab
.TryGetValue(mergeValues.a, out int aId))
262
if (!
_vocab
.TryGetValue(mergeValues.b, out int bId))
273
if (!
_vocab
.TryGetValue(newToken, out int newId))
574
private int? MapTokenToId(ReadOnlySpan<char> token) =>
_vocab
.TryGetValue(token, out int value) ? value : null;
594
public IReadOnlyDictionary<string, int> Vocabulary => _vocabOriginal ??= new ReadOnlyDictionary<string, int>(
_vocab
.ToDictionary(kvp => kvp.Key.Data!, kvp => kvp.Value));
913
if (
_vocab
.TryGetValue(s, out int id))
935
if (!
_vocab
.TryGetValue(UnknownToken, out int value))
944
if (!
_vocab
.TryGetValue(UnknownToken, out int value))