From ae5f75965f8202c8478622763a27ef1848a8ed1a Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 16 Mar 2016 11:27:16 -0400 Subject: Added more inflections, word relationships, and pronunciations Nouns, adjectives, and adverbs now have inflected forms. A large number of WordNet word relationships (all noun-noun relationships, plus synonymy and antonymy for all word types except verbs) have been added. Additionally, CMUDICT is now being used to store word pronunciations for rhyming purposes. Verbly is now also a compiled library rather than being header-only due to the complexity of the query interface. --- verb.h | 68 ++++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 37 insertions(+), 31 deletions(-) (limited to 'verb.h') diff --git a/verb.h b/verb.h index 42c8dc2..7cc87e2 100644 --- a/verb.h +++ b/verb.h @@ -1,8 +1,6 @@ #ifndef VERB_H_BCC929AD #define VERB_H_BCC929AD -#include - namespace verbly { /*class frame_part { @@ -26,42 +24,50 @@ namespace verbly { } };*/ - enum class conjugation { - present_participle, - past_participle, - infinitive - }; - - class verb { + class verb : public word { private: - int id; + std::string _infinitive; + std::string _past_tense; + std::string _past_participle; + std::string _ing_form; + std::string _s_form; + + friend class verb_query; public: - verb(int id) : id(id) - { - - } + verb(const data& _data, int _id); - std::string infinitive; - std::string past_tense; - std::string past_participle; - std::string ing_form; - std::string s_form; - //std::vector frames; + std::string base_form() const; + std::string infinitive_form() const; + std::string past_tense_form() const; + std::string past_participle_form() const; + std::string ing_form() const; + std::string s_form() const; + }; + + class verb_query { + public: + verb_query(const data& _data); - std::string conjugate(conjugation infl) const - { - switch (infl) - { - case conjugation::infinitive: return infinitive; - case conjugation::past_participle: return past_participle; - case conjugation::present_participle: return ing_form; - } - } + verb_query& limit(int _limit); + verb_query& random(bool _random); + verb_query& except(const verb& _word); + verb_query& rhymes_with(const word& _word); + verb_query& has_pronunciation(bool _has_prn); + + std::list run() const; + + const static int unlimited = -1; + + private: + const data& _data; + int _limit = unlimited; + bool _random = false; + std::list _rhymes; + std::list _except; + bool _has_prn = false; }; }; -#include "token.h" - #endif /* end of include guard: VERB_H_BCC929AD */ -- cgit 1.4.1