32 #ifndef MODULE_ANALYZER_ALGO_WORDSOVERTIME_HPP_ 33 #define MODULE_ANALYZER_ALGO_WORDSOVERTIME_HPP_ 35 #include "../Thread.hpp" 37 #include "../../../Data/Data.hpp" 38 #include "../../../Helper/DateTime.hpp" 39 #include "../../../Helper/Memory.hpp" 40 #include "../../../Main/Database.hpp" 41 #include "../../../Struct/StatusSetter.hpp" 42 #include "../../../Struct/TextMap.hpp" 43 #include "../../../Struct/ThreadOptions.hpp" 44 #include "../../../Struct/ThreadStatus.hpp" 51 #include <string_view> 52 #include <unordered_set> 81 std::unordered_set<std::string> articles;
82 std::uint64_t sentences{};
83 std::uint64_t words{};
94 using ResultMap = std::map<std::string, DateResults>;
95 using StringString = std::pair<std::string, std::string>;
115 std::string_view
getName()
const override;
140 bool firstTick{
true};
143 std::map<std::string, DateResults> dateResults;
144 std::string previousDate;
151 ResultMap::iterator addDateGroup(
const std::string& group);
152 void fillGap(
const std::string& table,
const std::string& date);
153 void insertDataSet(
const std::string& table,
const std::string& date,
const DateResults& results);
Namespace for algorithm classes.
Definition: All.cpp:52
void onAlgoInit() override
Generates the corpus.
Definition: WordsOverTime.cpp:111
Abstract class providing thread functionality to algorithm (child) classes.
Definition: Thread.hpp:84
Thread status containing its ID, status message, pause state, and progress.
Definition: ThreadStatus.hpp:54
Text map entry.
Definition: TextMap.hpp:49
Thread options containing the name of the module run, as well as the IDs of the website, URL list, and configuration used.
Definition: ThreadOptions.hpp:40
void onAlgoInitTarget() override
Initializes the target table for the algorithm.
Definition: WordsOverTime.cpp:89
Class handling database access for the command-and-control and its threads.
Definition: Database.hpp:366
Class for analyzer exceptions to be used by algorithms.
Definition: Thread.hpp:242
void onAlgoUnpause() override
Does nothing.
Definition: WordsOverTime.cpp:180
Structure containing all the data needed to keep the status of a thread updated.
Definition: StatusSetter.hpp:57
std::string_view getName() const override
Returns the name of the algorithm.
Definition: WordsOverTime.cpp:75
void parseAlgoOption() override
Does nothing.
Definition: WordsOverTime.cpp:190
constexpr auto wordsNumberOfColumns
The number of columns to write to the target table.
Definition: WordsOverTime.hpp:69
Counts the occurrence of articles, sentences, and tokens in a corpus over time.
Definition: WordsOverTime.hpp:78
void onAlgoClear() override
Does nothing.
Definition: WordsOverTime.cpp:183
void checkAlgoOptions() override
Does nothing.
Definition: WordsOverTime.cpp:193
WordsOverTime(Main::Database &dbBase, const ThreadOptions &threadOptions, const ThreadStatus &threadStatus)
Continues a previously interrupted algorithm run.
Definition: WordsOverTime.cpp:44
void onAlgoTick() override
Counts articles, sentences, and words.
Definition: WordsOverTime.cpp:163
constexpr auto wordsUpdateProgressEvery
Indicates after how many date groups the progress of the thread will be updated.
Definition: WordsOverTime.hpp:66
void onAlgoPause() override
Does nothing.
Definition: WordsOverTime.cpp:177
void resetAlgo() override
Resets the algorithm.
Definition: WordsOverTime.cpp:201