diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-27 14:28:54 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-27 14:28:54 -0400 |
commit | 4c94e100e87a09284f0e0a5bc0df688672492a1e (patch) | |
tree | f94611f057268dbc1000fb66cd89a8d3ad809d7a /generator/generator.cpp | |
parent | 429f6195f6a4410ae45ef3f560b0745ac60184c1 (diff) | |
download | verbly-4c94e100e87a09284f0e0a5bc0df688672492a1e.tar.gz verbly-4c94e100e87a09284f0e0a5bc0df688672492a1e.tar.bz2 verbly-4c94e100e87a09284f0e0a5bc0df688672492a1e.zip |
Added prefix/suffix search, and word complexity search for nouns, adjectives, and adverbs
Word complexity refers to the number of words in a noun, adjective, or adverb.
Diffstat (limited to 'generator/generator.cpp')
-rw-r--r-- | generator/generator.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/generator/generator.cpp b/generator/generator.cpp index aea750c..6fbbfb8 100644 --- a/generator/generator.cpp +++ b/generator/generator.cpp | |||
@@ -1027,9 +1027,9 @@ int main(int argc, char** argv) | |||
1027 | { | 1027 | { |
1028 | if (nouns.count(word) == 1) | 1028 | if (nouns.count(word) == 1) |
1029 | { | 1029 | { |
1030 | query = "INSERT INTO nouns (singular, proper, plural) VALUES (?, ?, ?)"; | 1030 | query = "INSERT INTO nouns (singular, proper, complexity, plural) VALUES (?, ?, ?, ?)"; |
1031 | } else { | 1031 | } else { |
1032 | query = "INSERT INTO nouns (singular, proper) VALUES (?, ?)"; | 1032 | query = "INSERT INTO nouns (singular, proper, complexity) VALUES (?, ?, ?)"; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | break; | 1035 | break; |
@@ -1046,9 +1046,9 @@ int main(int argc, char** argv) | |||
1046 | { | 1046 | { |
1047 | if (adjectives.count(word) == 1) | 1047 | if (adjectives.count(word) == 1) |
1048 | { | 1048 | { |
1049 | query = "INSERT INTO adjectives (base_form, comparative, superlative) VALUES (?, ?, ?)"; | 1049 | query = "INSERT INTO adjectives (base_form, complexity, comparative, superlative) VALUES (?, ?, ?, ?)"; |
1050 | } else { | 1050 | } else { |
1051 | query = "INSERT INTO adjectives (base_form) VALUES (?)"; | 1051 | query = "INSERT INTO adjectives (base_form, complexity) VALUES (?, ?)"; |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | break; | 1054 | break; |
@@ -1058,9 +1058,9 @@ int main(int argc, char** argv) | |||
1058 | { | 1058 | { |
1059 | if (adjectives.count(word) == 1) | 1059 | if (adjectives.count(word) == 1) |
1060 | { | 1060 | { |
1061 | query = "INSERT INTO adverbs (base_form, comparative, superlative) VALUES (?, ?, ?)"; | 1061 | query = "INSERT INTO adverbs (base_form, complexity, comparative, superlative) VALUES (?, ?, ?, ?)"; |
1062 | } else { | 1062 | } else { |
1063 | query = "INSERT INTO adverbs (base_form) VALUES (?)"; | 1063 | query = "INSERT INTO adverbs (base_form, complexity) VALUES (?, ?)"; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | break; | 1066 | break; |
@@ -1082,9 +1082,11 @@ int main(int argc, char** argv) | |||
1082 | return isupper(ch); | 1082 | return isupper(ch); |
1083 | }) ? 1 : 0)); | 1083 | }) ? 1 : 0)); |
1084 | 1084 | ||
1085 | sqlite3_bind_int(ppstmt, 3, verbly::split<std::list<std::string>>(word, " ").size()); | ||
1086 | |||
1085 | if (nouns.count(word) == 1) | 1087 | if (nouns.count(word) == 1) |
1086 | { | 1088 | { |
1087 | sqlite3_bind_text(ppstmt, 3, nouns[word].plural.c_str(), nouns[word].plural.length(), SQLITE_STATIC); | 1089 | sqlite3_bind_text(ppstmt, 4, nouns[word].plural.c_str(), nouns[word].plural.length(), SQLITE_STATIC); |
1088 | } | 1090 | } |
1089 | 1091 | ||
1090 | break; | 1092 | break; |
@@ -1093,10 +1095,12 @@ int main(int argc, char** argv) | |||
1093 | case 3: // Adjective | 1095 | case 3: // Adjective |
1094 | case 4: // Adverb | 1096 | case 4: // Adverb |
1095 | { | 1097 | { |
1098 | sqlite3_bind_int(ppstmt, 2, verbly::split<std::list<std::string>>(word, " ").size()); | ||
1099 | |||
1096 | if (adjectives.count(word) == 1) | 1100 | if (adjectives.count(word) == 1) |
1097 | { | 1101 | { |
1098 | sqlite3_bind_text(ppstmt, 2, adjectives[word].comparative.c_str(), adjectives[word].comparative.length(), SQLITE_STATIC); | 1102 | sqlite3_bind_text(ppstmt, 3, adjectives[word].comparative.c_str(), adjectives[word].comparative.length(), SQLITE_STATIC); |
1099 | sqlite3_bind_text(ppstmt, 3, adjectives[word].superlative.c_str(), adjectives[word].superlative.length(), SQLITE_STATIC); | 1103 | sqlite3_bind_text(ppstmt, 4, adjectives[word].superlative.c_str(), adjectives[word].superlative.length(), SQLITE_STATIC); |
1100 | } | 1104 | } |
1101 | 1105 | ||
1102 | break; | 1106 | break; |