29 references to StringSpanOrdinalKey
Microsoft.ML.Tokenizers (29)
Model\BertTokenizer.cs (7)
39SeparatorTokenId = vocab[new StringSpanOrdinalKey(options.SeparatorToken)]; 42PaddingTokenId = vocab[new StringSpanOrdinalKey(options.PaddingToken)]; 45ClassificationTokenId = vocab[new StringSpanOrdinalKey(options.ClassificationToken)]; 48MaskingTokenId = vocab[new StringSpanOrdinalKey(options.MaskingToken)]; 778if (!vocab.TryGetValue(new StringSpanOrdinalKey(kvp.Key), out int id) || id != kvp.Value) 816if (token is null || !vocab.TryGetValue(new StringSpanOrdinalKey(token), out int id)) 835vocab[new StringSpanOrdinalKey(normalizedToken)] = id;
Model\BPETokenizer.cs (1)
259_specialTokens = specialTokens.ToDictionary(kvp => new StringSpanOrdinalKey(kvp.Key), kvp => (kvp.Value, kvp.Key));
Model\CodeGenTokenizer.cs (2)
134_specialTokens = specialTokens.ToDictionary(kvp => new StringSpanOrdinalKey(kvp.Key), kvp => (kvp.Value, kvp.Key)); 1628return new List<EncodedToken> { new EncodedToken(_vocab[new StringSpanOrdinalKey(tokenValue)].Id, tokenValue, new Range(mapping[0], mapping[0] + 1)) };
Model\EnglishRobertaTokenizer.cs (2)
961return new List<EncodedToken> { new EncodedToken(_vocab[new StringSpanOrdinalKey(tokenValue)], tokenValue, new Range(indexMapping[0], indexMapping[0] + 1)) }; 1050tokens.Add(new EncodedToken(_vocab[new StringSpanOrdinalKey(w)], w, new Range(indexMapping[index], indexMapping[index] + w.Length)));
Model\SentencePieceTokenizer.cs (2)
51_vocab.Add(new StringSpanOrdinalKey(piece.Piece), (i, piece.Score, (byte)piece.Type)); 85_specialTokens.Add(new StringSpanOrdinalKey(item.Key), item.Value);
Model\TiktokenTokenizer.cs (1)
247vocab[new StringSpanOrdinalKey(decodedToken)] = (rank, decodedToken);
Model\WordPieceTokenizer.cs (1)
110vocab.Add(new StringSpanOrdinalKey(line), lineNumber);
Utils\LruCache.cs (4)
51if (_cache.TryGetValue(new StringSpanOrdinalKey(key), out LinkedListNode<KeyValuePair<string, TValue>>? cached)) 101if (_cache.TryGetValue(new StringSpanOrdinalKey(key), out LinkedListNode<KeyValuePair<string, TValue>>? cached)) 113_cache.Remove(new StringSpanOrdinalKey(nodeToEvict!.Value.Key)); 117_cache[new StringSpanOrdinalKey(key)] = node;
Utils\StringSpanOrdinalKey.cs (9)
62_left = new StringSpanOrdinalKey(data1); 63_right = new StringSpanOrdinalKey(data2); 93return _map.TryGetValue(new StringSpanOrdinalKey(key), out value!); 112_map.Remove(new StringSpanOrdinalKey(key)); 122_map[new StringSpanOrdinalKey(k)] = v; 137new StringSpanOrdinalKey(reader.GetString()!); 142public override StringSpanOrdinalKey Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => new StringSpanOrdinalKey(reader.GetString()!); 163dictionary.Add(new StringSpanOrdinalKey(key!), (value, key!)); 186map.TryGetValue(new StringSpanOrdinalKey(key), out value!);