diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-19 09:01:55 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-19 09:01:55 -0400 |
commit | be20f774b7be28a6c8b5359351dc1907d7ac7da8 (patch) | |
tree | 2045eb38b1fcd09d9bf9f09cc62dec2eaebe8997 | |
parent | 365dda7937dae0b6edef1f498473c57c715eec1d (diff) | |
download | verbly-be20f774b7be28a6c8b5359351dc1907d7ac7da8.tar.gz verbly-be20f774b7be28a6c8b5359351dc1907d7ac7da8.tar.bz2 verbly-be20f774b7be28a6c8b5359351dc1907d7ac7da8.zip |
Added vowel sound identification
-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 | }; |