summary refs log tree commit diff stats
path: root/lib/word.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/word.cpp')
-rw-r--r--lib/word.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/word.cpp b/lib/word.cpp index 15af150..13c611f 100644 --- a/lib/word.cpp +++ b/lib/word.cpp
@@ -3,13 +3,20 @@
3 3
4namespace verbly { 4namespace verbly {
5 5
6 word::word(const data& _data, int _id) : _data(_data), _id(_id) 6 word::word()
7 {
8
9 }
10
11 word::word(const data& _data, int _id) : _data(&_data), _id(_id), _valid(true)
7 { 12 {
8 13
9 } 14 }
10 15
11 std::list<std::string> word::rhyme_phonemes() const 16 std::list<std::string> word::rhyme_phonemes() const
12 { 17 {
18 assert(_valid == true);
19
13 std::list<std::string> result; 20 std::list<std::string> result;
14 21
15 for (auto pronunciation : pronunciations) 22 for (auto pronunciation : pronunciations)
@@ -32,6 +39,8 @@ namespace verbly {
32 39
33 bool word::starts_with_vowel_sound() const 40 bool word::starts_with_vowel_sound() const
34 { 41 {
42 assert(_valid == true);
43
35 if (pronunciations.size() > 0) 44 if (pronunciations.size() > 0)
36 { 45 {
37 return std::any_of(std::begin(pronunciations), std::end(pronunciations), [] (std::list<std::string> phonemes) { 46 return std::any_of(std::begin(pronunciations), std::end(pronunciations), [] (std::list<std::string> phonemes) {