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

Method AddToken

library/cpp/tokenizer/nlpparserbase.h:167–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165 CurCharSpan.Len += 1;
166 }
167 void AddToken() {
168 Y_ASSERT(CurCharSpan.Len);
169 Y_ASSERT(CurCharSpan.Type == TOKEN_WORD || CurCharSpan.Type == TOKEN_NUMBER);
170
171 if (Current->GetSubtokenCount() == MAX_SUBTOKENS) {
172 TCharSpan last; // for backward compatibility the last subtoken of the previous multitoken is popped and ...
173 Current->CorrectLastToken(last);
174 Tokens.push_back(TParserToken(last)); // ... added to the front of the new multitoken
175 Current = &Tokens.back(); // new parser token, Current reassigned immediately after push_back()
176 }
177
178 Current->AddSubtoken(CurCharSpan, PrefixLen, PrefixChar, SuffixChar);
179
180 CurCharSpan.Pos = 0;
181 CurCharSpan.Len = 0; // it is checked in AddLastToken()
182 PrefixLen = 0;
183 PrefixChar = 0;
184 SuffixChar = 0;
185 }
186 void AddIdeograph(size_t len) {
187 Y_ASSERT(!CurCharSpan.Len && (len == 1 || len == 2));
188 Current->AddIdeograph(len);

Callers

nothing calls this directly

Calls 6

TParserTokenClass · 0.85
GetSubtokenCountMethod · 0.80
CorrectLastTokenMethod · 0.80
AddSubtokenMethod · 0.80
push_backMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected