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

Function AdjustSubtokens

library/cpp/tokenizer/multitokenutil.cpp:198–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198size_t AdjustSubtokens(TTokenStructure& subtokens, size_t maxLen) {
199 Y_ASSERT(!subtokens.empty());
200
201 TCharSpan* const first = &subtokens[0];
202 TCharSpan* p = first + subtokens.size() - 1;
203 while (p != first && p->Pos >= maxLen) {
204 --p;
205 }
206
207 CutSubtoken(*p, maxLen);
208 subtokens.resize(p - first + 1);
209 p->TokenDelim = TOKDELIM_NULL;
210 return p->EndPos() + p->SuffixLen;
211}
212
213size_t AdjustSubtokens(TTokenStructure& subtokens, size_t n, size_t maxLen) {
214 Y_ASSERT(n > 0);

Callers 1

CutTooLongMultitokenMethod · 0.85

Calls 6

CutSubtokenFunction · 0.85
EndPosMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected