From 4c94e100e87a09284f0e0a5bc0df688672492a1e Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 27 Mar 2016 14:28:54 -0400 Subject: 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. --- generator/generator.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'generator/generator.cpp') 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) { if (nouns.count(word) == 1) { - query = "INSERT INTO nouns (singular, proper, plural) VALUES (?, ?, ?)"; + query = "INSERT INTO nouns (singular, proper, complexity, plural) VALUES (?, ?, ?, ?)"; } else { - query = "INSERT INTO nouns (singular, proper) VALUES (?, ?)"; + query = "INSERT INTO nouns (singular, proper, complexity) VALUES (?, ?, ?)"; } break; @@ -1046,9 +1046,9 @@ int main(int argc, char** argv) { if (adjectives.count(word) == 1) { - query = "INSERT INTO adjectives (base_form, comparative, superlative) VALUES (?, ?, ?)"; + query = "INSERT INTO adjectives (base_form, complexity, comparative, superlative) VALUES (?, ?, ?, ?)"; } else { - query = "INSERT INTO adjectives (base_form) VALUES (?)"; + query = "INSERT INTO adjectives (base_form, complexity) VALUES (?, ?)"; } break; @@ -1058,9 +1058,9 @@ int main(int argc, char** argv) { if (adjectives.count(word) == 1) { - query = "INSERT INTO adverbs (base_form, comparative, superlative) VALUES (?, ?, ?)"; + query = "INSERT INTO adverbs (base_form, complexity, comparative, superlative) VALUES (?, ?, ?, ?)"; } else { - query = "INSERT INTO adverbs (base_form) VALUES (?)"; + query = "INSERT INTO adverbs (base_form, complexity) VALUES (?, ?)"; } break; @@ -1082,9 +1082,11 @@ int main(int argc, char** argv) return isupper(ch); }) ? 1 : 0)); + sqlite3_bind_int(ppstmt, 3, verbly::split>(word, " ").size()); + if (nouns.count(word) == 1) { - sqlite3_bind_text(ppstmt, 3, nouns[word].plural.c_str(), nouns[word].plural.length(), SQLITE_STATIC); + sqlite3_bind_text(ppstmt, 4, nouns[word].plural.c_str(), nouns[word].plural.length(), SQLITE_STATIC); } break; @@ -1093,10 +1095,12 @@ int main(int argc, char** argv) case 3: // Adjective case 4: // Adverb { + sqlite3_bind_int(ppstmt, 2, verbly::split>(word, " ").size()); + if (adjectives.count(word) == 1) { - sqlite3_bind_text(ppstmt, 2, adjectives[word].comparative.c_str(), adjectives[word].comparative.length(), SQLITE_STATIC); - sqlite3_bind_text(ppstmt, 3, adjectives[word].superlative.c_str(), adjectives[word].superlative.length(), SQLITE_STATIC); + sqlite3_bind_text(ppstmt, 3, adjectives[word].comparative.c_str(), adjectives[word].comparative.length(), SQLITE_STATIC); + sqlite3_bind_text(ppstmt, 4, adjectives[word].superlative.c_str(), adjectives[word].superlative.length(), SQLITE_STATIC); } break; -- cgit 1.4.1