summary refs log tree commit diff stats
path: root/lib/pronunciation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pronunciation.cpp')
-rw-r--r--lib/pronunciation.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/pronunciation.cpp b/lib/pronunciation.cpp index f5b742f..e937ba6 100644 --- a/lib/pronunciation.cpp +++ b/lib/pronunciation.cpp
@@ -6,64 +6,64 @@
6#include "util.h" 6#include "util.h"
7 7
8namespace verbly { 8namespace verbly {
9 9
10 const object pronunciation::objectType = object::pronunciation; 10 const object pronunciation::objectType = object::pronunciation;
11 11
12 const std::list<std::string> pronunciation::select = {"pronunciation_id", "phonemes", "syllables", "stress", "prerhyme", "rhyme"}; 12 const std::list<std::string> pronunciation::select = {"pronunciation_id", "phonemes", "syllables", "stress", "prerhyme", "rhyme"};
13 13
14 const field pronunciation::id = field::integerField(object::pronunciation, "pronunciation_id"); 14 const field pronunciation::id = field::integerField(object::pronunciation, "pronunciation_id");
15 const field pronunciation::numOfSyllables = field::integerField(object::pronunciation, "syllables"); 15 const field pronunciation::numOfSyllables = field::integerField(object::pronunciation, "syllables");
16 const field pronunciation::stress = field::stringField(object::pronunciation, "stress"); 16 const field pronunciation::stress = field::stringField(object::pronunciation, "stress");
17 17
18 const field pronunciation::form = field::joinThrough(object::pronunciation, "pronunciation_id", object::form, "forms_pronunciations", "form_id"); 18 const field pronunciation::form = field::joinThrough(object::pronunciation, "pronunciation_id", object::form, "forms_pronunciations", "form_id");
19 19
20 const field pronunciation::prerhyme = field::stringField(object::pronunciation, "prerhyme", true); 20 const field pronunciation::prerhyme = field::stringField(object::pronunciation, "prerhyme", true);
21 const field pronunciation::rhyme = field::stringField(object::pronunciation, "rhyme", true); 21 const field pronunciation::rhyme = field::stringField(object::pronunciation, "rhyme", true);
22 22
23 pronunciation::pronunciation(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) 23 pronunciation::pronunciation(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true)
24 { 24 {
25 id_ = sqlite3_column_int(row, 0); 25 id_ = sqlite3_column_int(row, 0);
26 26
27 std::string phonemesStr(reinterpret_cast<const char*>(sqlite3_column_text(row, 1))); 27 std::string phonemesStr(reinterpret_cast<const char*>(sqlite3_column_text(row, 1)));
28 phonemes_ = split<std::vector<std::string>>(phonemesStr, " "); 28 phonemes_ = split<std::vector<std::string>>(phonemesStr, " ");
29 29
30 syllables_ = sqlite3_column_int(row, 2); 30 syllables_ = sqlite3_column_int(row, 2);
31 stress_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 3))); 31 stress_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 3)));
32 32
33 if (sqlite3_column_type(row, 5) != SQLITE_NULL) 33 if (sqlite3_column_type(row, 5) != SQLITE_NULL)
34 { 34 {
35 hasRhyme_ = true; 35 hasRhyme_ = true;
36 36
37 prerhyme_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 4))); 37 prerhyme_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 4)));
38 rhyme_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 5))); 38 rhyme_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 5)));
39 } 39 }
40 } 40 }
41 41
42 filter pronunciation::rhymesWith(const pronunciation& arg) 42 filter pronunciation::rhymesWith(const pronunciation& arg)
43 { 43 {
44 return (prerhyme != arg.getPrerhyme()) && (rhyme == arg.getRhyme()); 44 return (prerhyme != arg.getPrerhyme()) && (rhyme == arg.getRhyme());
45 } 45 }
46 46
47 /*filter pronunciation::rhymesWith(const class form& arg) 47 /*filter pronunciation::rhymesWith(const class form& arg)
48 { 48 {
49 filter result; 49 filter result;
50 50
51 for (const pronunciation& p : arg.getPronunciations()) 51 for (const pronunciation& p : arg.getPronunciations())
52 { 52 {
53 result |= rhymesWith(p); 53 result |= rhymesWith(p);
54 } 54 }
55 55
56 return result; 56 return result;
57 } 57 }
58 58
59 filter pronunciation::rhymesWith(const lemma& arg) 59 filter pronunciation::rhymesWith(const lemma& arg)
60 { 60 {
61 return rhymesWith(arg.getBaseForm()); 61 return rhymesWith(arg.getBaseForm());
62 } 62 }
63 63
64 filter pronunciation::rhymesWith(const word& arg) 64 filter pronunciation::rhymesWith(const word& arg)
65 { 65 {
66 return rhymesWith(arg.getLemma()); 66 return rhymesWith(arg.getLemma());
67 }*/ 67 }*/
68 68
69}; 69};