From dc210ee6eba3b1d173808bd858113f6abd90bff1 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 16 Mar 2016 21:35:35 -0400 Subject: Added word derivational relationships (kind of eh at the moment) and moved verbly into its own directory --- lib/word.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/word.cpp (limited to 'lib/word.cpp') diff --git a/lib/word.cpp b/lib/word.cpp new file mode 100644 index 0000000..c50e7d3 --- /dev/null +++ b/lib/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