summary refs log tree commit diff stats
path: root/lib/form.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-02-03 09:15:28 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2023-02-03 09:16:28 -0500
commit64f26d4a3b80969e08a607f80dde87d49ad5c2e3 (patch)
tree92ab69c6550d696ac6b15e1366b54222e773ada9 /lib/form.cpp
parentf2aacc40f4c26b3f4d71d81090f05261f4969e29 (diff)
downloadverbly-64f26d4a3b80969e08a607f80dde87d49ad5c2e3.tar.gz
verbly-64f26d4a3b80969e08a607f80dde87d49ad5c2e3.tar.bz2
verbly-64f26d4a3b80969e08a607f80dde87d49ad5c2e3.zip
Added word frequency information
Diffstat (limited to 'lib/form.cpp')
-rw-r--r--lib/form.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/form.cpp b/lib/form.cpp index 256dc59..fa72c8a 100644 --- a/lib/form.cpp +++ b/lib/form.cpp
@@ -8,13 +8,14 @@ namespace verbly {
8 8
9 const object form::objectType = object::form; 9 const object form::objectType = object::form;
10 10
11 const std::list<std::string> form::select = {"form_id", "form", "complexity", "proper", "length"}; 11 const std::list<std::string> form::select = {"form_id", "form", "complexity", "proper", "length", "frequency"};
12 12
13 const field form::id = field::integerField(object::form, "form_id"); 13 const field form::id = field::integerField(object::form, "form_id");
14 const field form::text = field::stringField(object::form, "form"); 14 const field form::text = field::stringField(object::form, "form");
15 const field form::complexity = field::integerField(object::form, "complexity"); 15 const field form::complexity = field::integerField(object::form, "complexity");
16 const field form::proper = field::booleanField(object::form, "proper"); 16 const field form::proper = field::booleanField(object::form, "proper");
17 const field form::length = field::integerField(object::form, "length"); 17 const field form::length = field::integerField(object::form, "length");
18 const field form::frequency = field::integerField(object::form, "frequency");
18 19
19 const field form::pronunciations = field::joinThrough(object::form, "form_id", object::pronunciation, "forms_pronunciations", "pronunciation_id"); 20 const field form::pronunciations = field::joinThrough(object::form, "form_id", object::pronunciation, "forms_pronunciations", "pronunciation_id");
20 21
@@ -36,6 +37,12 @@ namespace verbly {
36 proper_ = (std::get<int>(row[3]) == 1); 37 proper_ = (std::get<int>(row[3]) == 1);
37 length_ = std::get<int>(row[4]); 38 length_ = std::get<int>(row[4]);
38 39
40 if (!mpark::holds_alternative<std::nullptr_t>(row[5]))
41 {
42 hasFreq_ = true;
43 frequency_ = mpark::get<int>(row[5]);
44 }
45
39 pronunciations_ = db.pronunciations(*this, pronunciation::id, -1).all(); 46 pronunciations_ = db.pronunciations(*this, pronunciation::id, -1).all();
40 } 47 }
41 48