From b53a4edeee0aea41322ed18fb2e5fb9914b40148 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Thu, 21 Mar 2024 13:23:42 +0100 Subject: [PATCH] feat: add one-cap word-list generator --- lib_vector_search/include/bucket_finder.h | 2 -- lib_vector_search/include/word_list.h | 1 + lib_vector_search/src/word_list.cpp | 13 +++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib_vector_search/include/bucket_finder.h b/lib_vector_search/include/bucket_finder.h index d4d9626..5606ca6 100644 --- a/lib_vector_search/include/bucket_finder.h +++ b/lib_vector_search/include/bucket_finder.h @@ -10,8 +10,6 @@ private: std::map groups_; public: - Bucket() = default; - void insert(const WordList &word_list, size_t first_index, size_t last_index); std::forward_list diff --git a/lib_vector_search/include/word_list.h b/lib_vector_search/include/word_list.h index b2365e2..b5a9300 100644 --- a/lib_vector_search/include/word_list.h +++ b/lib_vector_search/include/word_list.h @@ -11,6 +11,7 @@ public: WordList &multiply(size_t factor); WordList &shuffle(); + static WordList oneCap(); static WordList fourCaps(); static WordList fromFile(const std::filesystem::path &path); diff --git a/lib_vector_search/src/word_list.cpp b/lib_vector_search/src/word_list.cpp index e810451..6934beb 100644 --- a/lib_vector_search/src/word_list.cpp +++ b/lib_vector_search/src/word_list.cpp @@ -25,6 +25,19 @@ WordList &WordList::shuffle() { return *this; } +WordList WordList::oneCap() { + const static std::string charset_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + WordList word_list; + word_list.reserve(charset_.length()); + + for (auto char_1 : charset_) { + word_list.emplace_back(std::initializer_list({char_1})); + } + + return word_list; +}; + WordList WordList::fourCaps() { const static std::string charset_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";