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

Method GetDelimiter

library/cpp/token/token_iterator.h:195–209  ·  view source on GitHub ↗

@note NLP type of token is NLP_MISCTEXT; prefixes always considered as "misctext"; suffixes of non-words considered as "misctext"; this function can be called after the last token as well, especially when the last non-word token has the suffix

Source from the content-addressed store, hash-verified

193 //! this function can be called after the last token as well,
194 //! especially when the last non-word token has the suffix
195 void GetDelimiter(TWideToken& tok) const {
196 Y_ASSERT(!Tokens.empty()); // Next() must be called
197 //Y_ASSERT(!Finished());
198 const TCharSpan& prev = Tokens.back();
199 size_t endpos = prev.EndPos();
200 if (prev.Type == TOKEN_WORD) {
201 endpos += prev.SuffixLen;
202 if (!Finished() && Subtokens[First].PrefixLen)
203 endpos += GetAdditionalSuffixLen();
204 } else if (NlpType == NLP_INTEGER && !Finished() && Subtokens[First].PrefixLen)
205 endpos += GetIntegerSuffixLen();
206 tok.Token = Tok.Token + endpos;
207 tok.Leng = (Finished() ? Tok.Leng : Tok.SubTokens[First].Pos) - endpos; // length can be equal to 0 in case v1.0 -> v 1.0
208 tok.SubTokens.clear();
209 }
210};

Callers 1

Calls 4

EndPosMethod · 0.80
emptyMethod · 0.45
backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected