Compare commits

...

2 commits

Author SHA1 Message Date
千住柱間 2fce3c4a48
fix loop 2/2 2024-05-16 21:48:24 -04:00
千住柱間 7508ce6d0d
fix loop | by Perplex 2024-05-16 21:48:06 -04:00

View file

@ -45,9 +45,8 @@ int main(int argc, char* argv[]) {
const auto trie = xcdat::load<xcdat::trie_15_type>(dict_file); const auto trie = xcdat::load<xcdat::trie_15_type>(dict_file);
std::vector<std::string> substrings; std::vector<std::string> substrings;
std::vector<Entry> results;
while (!search_string.empty()) { while (!search_string.empty()) {
std::vector<Entry> results;
auto itr = trie.make_prefix_iterator(search_string); auto itr = trie.make_prefix_iterator(search_string);
while (itr.next()) { while (itr.next()) {
@ -79,9 +78,13 @@ int main(int argc, char* argv[]) {
if (pos != std::string::npos) { if (pos != std::string::npos) {
search_string.erase(0, pos + smallest_prefix.length()); search_string.erase(0, pos + smallest_prefix.length());
} }
else break;
std::cout << search_string << std::endl; std::cout << search_string << std::endl;
if (smallest_prefix.length() == 0)
break;
if (debug_mode) { if (debug_mode) {
raw_output += search_string + '\n'; raw_output += search_string + '\n';
} }