summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-03-19 09:01:55 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-03-19 09:01:55 -0400
commitbe20f774b7be28a6c8b5359351dc1907d7ac7da8 (patch)
tree2045eb38b1fcd09d9bf9f09cc62dec2eaebe8997 /lib
parent365dda7937dae0b6edef1f498473c57c715eec1d (diff)
downloadverbly-be20f774b7be28a6c8b5359351dc1907d7ac7da8.tar.gz
verbly-be20f774b7be28a6c8b5359351dc1907d7ac7da8.tar.bz2
verbly-be20f774b7be28a6c8b5359351dc1907d7ac7da8.zip
Added vowel sound identification
Diffstat (limited to 'lib')
-rw-r--r--lib/word.cpp8
-rw-r--r--lib/word.h1
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
3namespace verbly { 4namespace 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};