#pragma once #include "prelude.hpp" #include #include #include #include #include #include template using map = std::unordered_map; struct Document { map freqs; String filename; Document(std::string_view name, map&& mp); Document(std::string_view name); void show_freqs() const noexcept; }; fn filter_divs(std::string_view html) noexcept -> String; fn to_words(std::string_view lines) noexcept -> Vector; fn index_directory(std::filesystem::path dir) noexcept -> Vector; void cache_index(Ref> documents) noexcept; fn load_index() noexcept -> Vector; fn get_cache_dir() noexcept -> std::filesystem::path; fn count_query(Ref> documents, Ref query) noexcept -> Vector>; fn count_tfidf(Ref> documents, Ref query) noexcept -> Vector>; fn top_n_matches(Ref> documents, Ref query, U64 n) noexcept -> Vector>;