MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / insert

Method insert

subprojects/llama.cpp/src/llama-vocab.cpp:31–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 naive_trie() : has_value(false), value(0) {
30 }
31 void insert(const char * key, size_t len, int32_t value = 0) {
32 if (len == 0) {
33 this->has_value = true;
34 this->value = value;
35 return;
36 }
37 char c = key[0];
38 auto res = children.find(c);
39 if (res != children.end()) {
40 res->second.insert(key + 1, len - 1, value);
41 } else {
42 auto res = children.insert(std::make_pair(c, naive_trie()));
43 res.first->second.insert(key + 1, len - 1, value);
44 }
45 }
46 std::pair<const char *, size_t> get_longest_prefix(const char * key, size_t len, size_t offset = 0) const {
47 if (len == 0 || offset == len) {
48 return std::make_pair(key, offset);

Callers 15

setMethod · 0.45
pos_setMethod · 0.45
load_tensorsMethod · 0.45
seq_cpMethod · 0.45
seq_keepMethod · 0.45
find_slotMethod · 0.45
state_read_metaMethod · 0.45
set_inputMethod · 0.45
llama_params_fit_implFunction · 0.45
encodeMethod · 0.45

Calls 3

naive_trieClass · 0.70
findMethod · 0.65
endMethod · 0.45

Tested by

no test coverage detected