From 04338f2b040fee5142904c062e0e38c836601034 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 17 Apr 2016 13:44:37 -0400 Subject: Fixed perfect rhyming Rhyme detection now ensures that any rhymes it finds are perfect rhymes and not identical rhymes. Rhyme detection is also now a lot faster because additional information is stored in the datafile. Also fixed a bug in the query interface (and the generator) that could cause incorrect queries to be executed. --- lib/word.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lib/word.h') diff --git a/lib/word.h b/lib/word.h index dc6fac8..08797a3 100644 --- a/lib/word.h +++ b/lib/word.h @@ -3,6 +3,20 @@ namespace verbly { + class rhyme { + public: + rhyme(std::string prerhyme, std::string phonemes); + + std::string get_prerhyme() const; + std::string get_rhyme() const; + + bool operator==(const rhyme& other) const; + + private: + std::string _prerhyme; + std::string _rhyme; + }; + class word { protected: const data* _data; @@ -10,6 +24,7 @@ namespace verbly { bool _valid = false; std::list> pronunciations; + std::list rhymes; word(); word(const data& _data, int _id); @@ -24,7 +39,7 @@ namespace verbly { public: virtual std::string base_form() const = 0; - std::list rhyme_phonemes() const; + std::list get_rhymes() const; bool starts_with_vowel_sound() const; }; -- cgit 1.4.1