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

Function DetectNLPType

library/cpp/token/nlptypes.cpp:82–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82NLP_TYPE DetectNLPType(const TTokenStructure& subtokens) {
83 Y_ASSERT(subtokens.size() >= 1);
84 for (size_t i = 1; i < subtokens.size(); ++i) {
85 Y_ASSERT(subtokens[i].Type == TOKEN_WORD || subtokens[i].Type == TOKEN_NUMBER);
86 if (subtokens[i].Type != subtokens[0].Type)
87 return NLP_MARK;
88 }
89 if (subtokens[0].Type == TOKEN_WORD)
90 return NLP_WORD;
91 else if (subtokens[0].Type == TOKEN_MARK)
92 return NLP_MARK;
93 else if (subtokens[0].Type == TOKEN_FLOAT)
94 return NLP_FLOAT;
95 else if (subtokens[0].Type == TOKEN_NUMBER)
96 return NLP_INTEGER;
97 return NLP_MARK;
98}

Callers 1

PrepareMultitokenFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected