From be20f774b7be28a6c8b5359351dc1907d7ac7da8 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 19 Mar 2016 09:01:55 -0400 Subject: Added vowel sound identification --- lib/word.cpp | 8 ++++++++ lib/word.h | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/word.cpp b/lib/word.cpp index c50e7d3..156e7e0 100644 --- a/lib/word.cpp +++ b/lib/word.cpp @@ -1,4 +1,5 @@ #include "verbly.h" +#include namespace verbly { @@ -29,4 +30,11 @@ namespace verbly { return result; } + bool word::starts_with_vowel_sound() const + { + return std::any_of(std::begin(pronunciations), std::end(pronunciations), [] (std::list phonemes) { + return (phonemes.front().find_first_of("012") != std::string::npos); + }); + } + }; diff --git a/lib/word.h b/lib/word.h index 23ddb2b..db3242a 100644 --- a/lib/word.h +++ b/lib/word.h @@ -28,6 +28,7 @@ namespace verbly { virtual std::string base_form() const = 0; std::list rhyme_phonemes() const; + bool starts_with_vowel_sound() const; }; }; -- cgit 1.4.1