Remove trailing whitespaces

This commit is contained in:
Igor Pissolati 2023-06-19 23:03:58 -03:00
parent 7f9d720105
commit e468e75515

View file

@ -545,7 +545,7 @@ typedef llama_buffer llama_ctx_buffer;
struct llama_trie_node { struct llama_trie_node {
llama_trie_node(): is_terminator(false) {} llama_trie_node(): is_terminator(false) {}
std::unordered_map<char, llama_trie_node*> children; std::unordered_map<char, llama_trie_node*> children;
bool is_terminator; bool is_terminator;
}; };
@ -560,7 +560,7 @@ public:
if (word.empty()) { if (word.empty()) {
return; return;
} }
llama_trie_node *ref = root_; llama_trie_node *ref = root_;
for (char c : word) { for (char c : word) {
if (ref->children.find(c) == ref->children.end()) { if (ref->children.find(c) == ref->children.end()) {
@ -630,7 +630,7 @@ public:
end = lookahead_index; end = lookahead_index;
skip = lookahead_index; skip = lookahead_index;
} }
auto looktrie_pointer_it = looktrie_pointer->children.find(next_char); auto looktrie_pointer_it = looktrie_pointer->children.find(next_char);
while (looktrie_pointer_it != looktrie_pointer->children.end()) { while (looktrie_pointer_it != looktrie_pointer->children.end()) {
looktrie_pointer = looktrie_pointer_it->second; looktrie_pointer = looktrie_pointer_it->second;
@ -640,7 +640,7 @@ public:
end = lookahead_index; end = lookahead_index;
skip = lookahead_index; skip = lookahead_index;
} }
if (lookahead_index == text.size()) { if (lookahead_index == text.size()) {
// End of string // End of string
break; break;
@ -649,13 +649,13 @@ public:
looktrie_pointer_it = looktrie_pointer->children.find(next_char); looktrie_pointer_it = looktrie_pointer->children.find(next_char);
} }
} }
offsets.push_back(start); offsets.push_back(start);
offsets.push_back(end); offsets.push_back(end);
reset = true; reset = true;
break; break;
} }
auto trie_pointer_it = trie_pointer->children.find(current_char); auto trie_pointer_it = trie_pointer->children.find(current_char);
if (trie_pointer_it != trie_pointer->children.end()) { if (trie_pointer_it != trie_pointer->children.end()) {
// The current character being looked at has a match within the trie // The current character being looked at has a match within the trie
@ -669,12 +669,12 @@ public:
state = states.erase(state); state = states.erase(state);
} }
} }
if (reset) { if (reset) {
// Clear the full start (we found a real match) // Clear the full start (we found a real match)
states.clear(); states.clear();
} }
// If this character is a starting character within the trie // If this character is a starting character within the trie
// start keeping track of this partial match. // start keeping track of this partial match.
auto children_it = root_->children.find(current_char); auto children_it = root_->children.find(current_char);
@ -682,7 +682,7 @@ public:
states[current] = children_it->second; states[current] = children_it->second;
} }
} }
// We have a cut at the end with states. // We have a cut at the end with states.
for (const auto & state : states) { for (const auto & state : states) {
int start = state.first; int start = state.first;
@ -696,7 +696,7 @@ public:
break; break;
} }
} }
offsets.push_back(text.size()); offsets.push_back(text.size());
return offsets; return offsets;
} }