summary refs log tree commit diff stats
path: root/generator
diff options
context:
space:
mode:
Diffstat (limited to 'generator')
-rw-r--r--generator/generator.cpp22
-rw-r--r--generator/schema.sql9
2 files changed, 19 insertions, 12 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;
diff --git a/generator/schema.sql b/generator/schema.sql index 2295444..f2445f0 100644 --- a/generator/schema.sql +++ b/generator/schema.sql
@@ -36,7 +36,8 @@ CREATE TABLE `adjectives` (
36 `base_form` VARCHAR(32) NOT NULL, 36 `base_form` VARCHAR(32) NOT NULL,
37 `comparative` VARCHAR(32), 37 `comparative` VARCHAR(32),
38 `superlative` VARCHAR(32), 38 `superlative` VARCHAR(32),
39 `position` CHAR(1) 39 `position` CHAR(1),
40 `complexity` INTEGER NOT NULL
40); 41);
41 42
42DROP TABLE IF EXISTS `adverbs`; 43DROP TABLE IF EXISTS `adverbs`;
@@ -44,7 +45,8 @@ CREATE TABLE `adverbs` (
44 `adverb_id` INTEGER PRIMARY KEY, 45 `adverb_id` INTEGER PRIMARY KEY,
45 `base_form` VARCHAR(32) NOT NULL, 46 `base_form` VARCHAR(32) NOT NULL,
46 `comparative` VARCHAR(32), 47 `comparative` VARCHAR(32),
47 `superlative` VARCHAR(32) 48 `superlative` VARCHAR(32),
49 `complexity` INTEGER NOT NULL
48); 50);
49 51
50DROP TABLE IF EXISTS `nouns`; 52DROP TABLE IF EXISTS `nouns`;
@@ -52,7 +54,8 @@ CREATE TABLE `nouns` (
52 `noun_id` INTEGER PRIMARY KEY, 54 `noun_id` INTEGER PRIMARY KEY,
53 `singular` VARCHAR(32) NOT NULL, 55 `singular` VARCHAR(32) NOT NULL,
54 `plural` VARCHAR(32), 56 `plural` VARCHAR(32),
55 `proper` INTEGER(1) NOT NULL 57 `proper` INTEGER(1) NOT NULL,
58 `complexity` INTEGER NOT NULL
56); 59);
57 60
58DROP TABLE IF EXISTS `hypernymy`; 61DROP TABLE IF EXISTS `hypernymy`;