From 3aceae8ab1eb5992110ea57a9479bbc3177feb21 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. --- verbly/verb.h | 68 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 31 deletions(-) (limited to 'verbly/verb.h') diff --git a/verbly/verb.h b/verbly/verb.h index 42c8dc2..7cc87e2 100644 --- a/verbly/verb.h +++ b/verbly/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