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/word.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 verbly/word.cpp (limited to 'verbly/word.cpp') diff --git a/verbly/word.cpp b/verbly/word.cpp new file mode 100644 index 0000000..c50e7d3 --- /dev/null +++ b/verbly/word.cpp @@ -0,0 +1,32 @@ +#include "verbly.h" + +namespace verbly { + + word::word(const data& _data, int _id) : _data(_data), _id(_id) + { + + } + + std::list word::rhyme_phonemes() const + { + std::list result; + + for (auto pronunciation : pronunciations) + { + auto phemstrt = std::find_if(std::begin(pronunciation), std::end(pronunciation), [] (std::string phoneme) { + return phoneme.find("1") != std::string::npos; + }); + + std::stringstream rhymer; + for (auto it = phemstrt; it != std::end(pronunciation); it++) + { + rhymer << " " << *it; + } + + result.push_back(rhymer.str()); + } + + return result; + } + +}; -- cgit 1.4.1