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

Method CreateTrie

library/cpp/containers/comptrie/comptrie_ut.cpp:300–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298
299template <class T>
300void TCompactTrieTest::CreateTrie(IOutputStream& out, bool minimize, bool useFastLayout) {
301 TCompactTrieBuilder<T> builder;
302
303 for (auto& i : SampleData) {
304 size_t len = strlen(i);
305
306 builder.Add(MakeWideKey<T>(i, len), len * 2);
307 }
308
309 TBufferOutput tmp2;
310 IOutputStream& currentOutput = useFastLayout ? tmp2 : out;
311 if (minimize) {
312 TBufferOutput buftmp;
313 builder.Save(buftmp);
314 CompactTrieMinimize<TCompactTriePacker<ui64>>(currentOutput, buftmp.Buffer().Data(), buftmp.Buffer().Size(), false);
315 } else {
316 builder.Save(currentOutput);
317 }
318 if (useFastLayout) {
319 CompactTrieMakeFastLayout<TCompactTriePacker<T>>(out, tmp2.Buffer().Data(), tmp2.Buffer().Size(), false);
320 }
321}
322
323// Iterates over all strings of length <= 4 made of letters a-g.
324static bool LexicographicStep(TString& s) {

Callers

nothing calls this directly

Calls 4

AddMethod · 0.45
SaveMethod · 0.45
DataMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected