#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, }; 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); // 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; std::vector word_ids; std::vector pronunciation_ids; std::optional anagram_set_id; std::optional reverse_form_id; 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_; }; #endif /* end of include guard: GENERATOR_H_D5C6A724 */