diff options
-rw-r--r-- | lib/word.cpp | 8 | ||||
-rw-r--r-- | lib/word.h | 1 |
2 files changed, 9 insertions, 0 deletions
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 @@ | |||
1 | #include "verbly.h" | 1 | #include "verbly.h" |
2 | #include <algorithm> | ||
2 | 3 | ||
3 | namespace verbly { | 4 | namespace verbly { |
4 | 5 | ||
@@ -29,4 +30,11 @@ namespace verbly { | |||
29 | return result; | 30 | return result; |
30 | } | 31 | } |
31 | 32 | ||
33 | bool word::starts_with_vowel_sound() const | ||
34 | { | ||
35 | return std::any_of(std::begin(pronunciations), std::end(pronunciations), [] (std::list<std::string> phonemes) { | ||
36 | return (phonemes.front().find_first_of("012") != std::string::npos); | ||
37 | }); | ||
38 | } | ||
39 | |||
32 | }; | 40 | }; |
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 { | |||
28 | virtual std::string base_form() const = 0; | 28 | virtual std::string base_form() const = 0; |
29 | 29 | ||
30 | std::list<std::string> rhyme_phonemes() const; | 30 | std::list<std::string> rhyme_phonemes() const; |
31 | bool starts_with_vowel_sound() const; | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | }; | 34 | }; |