MCPcopy Create free account
hub / github.com/catboost/catboost / AddToken

Function AddToken

library/cpp/text_processing/dictionary/bpe_builder.cpp:7–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6template <typename T>
7static void AddToken(
8 const T& token,
9 bool skipUnknown,
10 const TDictionary& alphabet,
11 TEraseList<TTokenId>* tokenIdsList
12) {
13 auto tokenId = alphabet.Apply(token);
14 if (tokenId != alphabet.GetUnknownTokenId()) {
15 tokenIdsList->PushToken(tokenId);
16 } else {
17 if (skipUnknown) {
18 return;
19 }
20 tokenIdsList->PushToken(tokenId);
21 }
22}
23
24template <typename TStringVector>
25static void AddImpl(

Callers 3

AddImplFunction · 0.85
AddLastTokenMethod · 0.85
AddLastTokenMethod · 0.85

Calls 3

PushTokenMethod · 0.80
ApplyMethod · 0.45
GetUnknownTokenIdMethod · 0.45

Tested by

no test coverage detected