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. --- token.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 token.cpp (limited to 'token.cpp') diff --git a/token.cpp b/token.cpp new file mode 100644 index 0000000..aa8f50e --- /dev/null +++ b/token.cpp @@ -0,0 +1,53 @@ +#include "verbly.h" + +namespace verbly { + + token::token(token::type _type) : _type(_type) + { + + } + + token::type token::token_type() const + { + return _type; + } + + verb_token::verb_token(const class verb& _verb) : token(token::type::verb), _verb(&_verb) + { + + } + + const class verb& verb_token::verb() const + { + return *_verb; + } + + verb_token& verb_token::inflect(verb_token::inflection infl) + { + _inflection = infl; + return *this; + } + + bool verb_token::complete() const + { + return true; + } + + std::string verb_token::compile() const + { + switch (_inflection) + { + case inflection::infinitive: return _verb->infinitive_form(); + case inflection::past_tense: return _verb->past_tense_form(); + case inflection::past_participle: return _verb->past_participle_form(); + case inflection::ing_form: return _verb->ing_form(); + case inflection::s_form: return _verb->s_form(); + } + } + + token* verb_token::copy() const + { + return new verb_token(*this); + } + +}; -- cgit 1.4.1