#ifndef GENERATOR_H_D5C6A724 #define GENERATOR_H_D5C6A724 #include #include #include #include #include #include #include #include enum PuzzleType { kWhiteTop = 0, kWhiteBottom = 1, kYellowTop = 2, kYellowMiddle = 3, kBlackTop = 4, kBlackMiddle = 5, kBlackBottom = 6, kDoubleBlackBottom = 7, kRedTop = 8, kRedMiddle = 9, kRedBottom = 10, kBlueTop = 11, kBlueMiddle = 12, kBlueBottom = 13, kPurpleTop = 14, kPurpleMiddle = 15, kColorIs = 16, }; class generator { public: // Constructor generator(std::string agidPath, std::string wordNetPath, std::string cmudictPath, std::string wordfreqPath, std::string datadirPath, std::string outputPath); // Action void run(); private: // Helpers size_t LookupOrCreatePronunciation(const std::string& phonemes); size_t LookupOrCreateForm(const std::string& form); size_t LookupOrCreateWord(const std::string& word); void AddPronunciationToForm(size_t pronunciation_id, size_t form_id); void AddFormToWord(size_t form_id, size_t word_id); void AddWordToSynset(size_t word_id, int wnid); void AddFormToAnagramSet(size_t form_id, const std::string& sorted_letters); void AddPronunciationToAnaphoneSet(size_t pronunciation_id, const std::string& sorted_phonemes); void FindComboPuzzles(std::string text, PuzzleType left_type, PuzzleType right_type); // Input std::string agidPath_; std::string wordNetPath_; std::string cmudictPath_; std::string wordfreqPath_; std::filesystem::path datadirPath_; // Output std::string outputPath_; // Indexes struct Pronunciation { size_t id; std::string phonemes; std::string prerhyme; std::string rhyme; std::vector form_ids; std::optional anaphone_set_id; std::string stressless_phonemes; }; struct Form { size_t id; std::string text; bool is_base_form = false; std::vector word_ids; std::vector pronunciation_ids; std::optional anagram_set_id; std::optional reverse_form_id; std::optional ciphered; std::unordered_map> puzzles; }; struct Word { size_t id; size_t base_form_id; std::vector form_ids; std::vector synsets; }; std::vector pronunciations_; std::unordered_map pronunciation_by_phonemes_; std::unordered_map> pronunciations_by_rhyme_; std::unordered_map> pronunciations_by_blank_phonemes_; std::vector> anaphone_sets_; std::unordered_map anaphone_set_by_sorted_phonemes_; std::vector
forms_; std::unordered_map form_by_text_; std::vector> anagram_sets_; std::unordered_map anagram_set_by_sorted_letters_; std::vector words_; std::unordered_map> words_by_base_; std::map, size_t> word_by_wnid_and_wnum_; std::vector> synsets_; std::unordered_map synset_by_wnid_; std::map wanderlust_; std::map>>> combos_; }; #endif /* end of include guard: GENERATOR_H_D5C6A724 */