diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | furries.cpp | 2 | ||||
-rw-r--r-- | verbly/CMakeLists.txt | 9 | ||||
-rw-r--r-- | verbly/LICENSE | 3 | ||||
-rw-r--r-- | verbly/generator/CMakeLists.txt | 12 | ||||
-rw-r--r-- | verbly/generator/generator.cpp (renamed from generator.cpp) | 147 | ||||
-rw-r--r-- | verbly/generator/progress.h (renamed from progress.h) | 0 | ||||
-rw-r--r-- | verbly/generator/schema.sql (renamed from schema.sql) | 48 | ||||
-rw-r--r-- | verbly/lib/adjective.cpp (renamed from verbly/adjective.cpp) | 104 | ||||
-rw-r--r-- | verbly/lib/adjective.h (renamed from verbly/adjective.h) | 10 | ||||
-rw-r--r-- | verbly/lib/adverb.cpp (renamed from verbly/adverb.cpp) | 104 | ||||
-rw-r--r-- | verbly/lib/adverb.h (renamed from verbly/adverb.h) | 13 | ||||
-rw-r--r-- | verbly/lib/c++14.h (renamed from verbly/c++14.h) | 0 | ||||
-rw-r--r-- | verbly/lib/data.cpp (renamed from verbly/data.cpp) | 0 | ||||
-rw-r--r-- | verbly/lib/data.h (renamed from verbly/data.h) | 0 | ||||
-rw-r--r-- | verbly/lib/noun.cpp (renamed from verbly/noun.cpp) | 116 | ||||
-rw-r--r-- | verbly/lib/noun.h (renamed from verbly/noun.h) | 12 | ||||
-rw-r--r-- | verbly/lib/token.cpp (renamed from verbly/token.cpp) | 0 | ||||
-rw-r--r-- | verbly/lib/token.h (renamed from verbly/token.h) | 0 | ||||
-rw-r--r-- | verbly/lib/util.h (renamed from verbly/util.h) | 0 | ||||
-rw-r--r-- | verbly/lib/verb.cpp (renamed from verbly/verb.cpp) | 0 | ||||
-rw-r--r-- | verbly/lib/verb.h (renamed from verbly/verb.h) | 0 | ||||
-rw-r--r-- | verbly/lib/verbly.h (renamed from verbly/verbly.h) | 0 | ||||
-rw-r--r-- | verbly/lib/word.cpp (renamed from verbly/word.cpp) | 0 | ||||
-rw-r--r-- | verbly/lib/word.h (renamed from verbly/word.h) | 0 |
26 files changed, 579 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore index 461a080..52a9693 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -4,7 +4,3 @@ CMakeCache.txt | |||
4 | CMakeFiles/ | 4 | CMakeFiles/ |
5 | Makefile | 5 | Makefile |
6 | cmake_install.cmake | 6 | cmake_install.cmake |
7 | furries | ||
8 | furries.dSYM/ | ||
9 | generator | ||
10 | generator.dSYM/ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a884b5..3a8fab8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -2,23 +2,14 @@ cmake_minimum_required (VERSION 2.6) | |||
2 | project (furries) | 2 | project (furries) |
3 | 3 | ||
4 | add_subdirectory(vendor/twitcurl/libtwitcurl) | 4 | add_subdirectory(vendor/twitcurl/libtwitcurl) |
5 | add_subdirectory(vendor/verbly) | ||
5 | 6 | ||
6 | find_package(PkgConfig) | 7 | find_package(PkgConfig) |
7 | pkg_check_modules(YamlCpp yaml-cpp REQUIRED) | 8 | pkg_check_modules(YamlCpp yaml-cpp REQUIRED) |
8 | pkg_check_modules(sqlite3 sqlite3 REQUIRED) | 9 | pkg_check_modules(sqlite3 sqlite3 REQUIRED) |
9 | find_package(libxml2 REQUIRED) | ||
10 | 10 | ||
11 | add_library(verbly verbly/data.cpp verbly/adjective.cpp verbly/noun.cpp verbly/verb.cpp verbly/adverb.cpp verbly/token.cpp verbly/word.cpp) | 11 | include_directories(vendor/twitcurl/libtwitcurl ${sqlite3_INCLUDE_DIR} vendor/verbly/lib) |
12 | set_property(TARGET verbly PROPERTY CXX_STANDARD 11) | ||
13 | set_property(TARGET verbly PROPERTY CXX_STANDARD_REQUIRED ON) | ||
14 | |||
15 | include_directories(vendor/twitcurl/libtwitcurl ${LIBXML2_INCLUDE_DIR} ${sqlite3_INCLUDE_DIR}) | ||
16 | add_executable(furries furries.cpp) | 12 | add_executable(furries furries.cpp) |
17 | set_property(TARGET furries PROPERTY CXX_STANDARD 11) | 13 | set_property(TARGET furries PROPERTY CXX_STANDARD 11) |
18 | set_property(TARGET furries PROPERTY CXX_STANDARD_REQUIRED ON) | 14 | set_property(TARGET furries PROPERTY CXX_STANDARD_REQUIRED ON) |
19 | target_link_libraries(furries ${sqlite3_LIBRARIES} ${YamlCpp_LIBRARIES} twitcurl curl verbly) | 15 | target_link_libraries(furries ${sqlite3_LIBRARIES} ${YamlCpp_LIBRARIES} twitcurl curl verbly) |
20 | |||
21 | add_executable(generator generator.cpp) | ||
22 | set_property(TARGET generator PROPERTY CXX_STANDARD 11) | ||
23 | set_property(TARGET generator PROPERTY CXX_STANDARD_REQUIRED ON) | ||
24 | target_link_libraries(generator ${sqlite3_LIBRARIES} ${LIBXML2_LIBRARIES}) | ||
diff --git a/furries.cpp b/furries.cpp index 55dfb7b..6e701d4 100644 --- a/furries.cpp +++ b/furries.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <ctime> | 4 | #include <ctime> |
5 | #include <sstream> | 5 | #include <sstream> |
6 | #include <twitcurl.h> | 6 | #include <twitcurl.h> |
7 | #include "verbly/verbly.h" | 7 | #include <verbly.h> |
8 | 8 | ||
9 | class fill_blanks { | 9 | class fill_blanks { |
10 | private: | 10 | private: |
diff --git a/verbly/CMakeLists.txt b/verbly/CMakeLists.txt new file mode 100644 index 0000000..5a3e526 --- /dev/null +++ b/verbly/CMakeLists.txt | |||
@@ -0,0 +1,9 @@ | |||
1 | cmake_minimum_required (VERSION 2.6) | ||
2 | project (verbly) | ||
3 | |||
4 | find_package(PkgConfig) | ||
5 | pkg_check_modules(sqlite3 sqlite3 REQUIRED) | ||
6 | |||
7 | add_library(verbly lib/data.cpp lib/adjective.cpp lib/noun.cpp lib/verb.cpp lib/adverb.cpp lib/token.cpp lib/word.cpp) | ||
8 | set_property(TARGET verbly PROPERTY CXX_STANDARD 11) | ||
9 | set_property(TARGET verbly PROPERTY CXX_STANDARD_REQUIRED ON) | ||
diff --git a/verbly/LICENSE b/verbly/LICENSE new file mode 100644 index 0000000..4c4b690 --- /dev/null +++ b/verbly/LICENSE | |||
@@ -0,0 +1,3 @@ | |||
1 | WordNet Release 3.0 | ||
2 | |||
3 | This software and database is being provided to you, the LICENSEE, by Princeton University under the following license. By obtaining, using and/or copying this software and database, you agree that you have read, understood, and will comply with these terms and conditions.: Permission to use, copy, modify and distribute this software and database and its documentation for any purpose and without fee or royalty is hereby granted, provided that you agree to comply with the following copyright notice and statements, including the disclaimer, and that the same appear on ALL copies of the software, database and documentation, including modifications that you make for internal use or for distribution. WordNet 3.0 Copyright 2006 by Princeton University. All rights reserved. THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT- ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. The name of Princeton University or Princeton may not be used in advertising or publicity pertaining to distribution of the software and/or database. Title to copyright in this software, database and any associated documentation shall at all times remain with Princeton University and LICENSEE agrees to preserve same. \ No newline at end of file | ||
diff --git a/verbly/generator/CMakeLists.txt b/verbly/generator/CMakeLists.txt new file mode 100644 index 0000000..bbc3c4f --- /dev/null +++ b/verbly/generator/CMakeLists.txt | |||
@@ -0,0 +1,12 @@ | |||
1 | cmake_minimum_required (VERSION 2.6) | ||
2 | project (generator) | ||
3 | |||
4 | find_package(PkgConfig) | ||
5 | pkg_check_modules(sqlite3 sqlite3 REQUIRED) | ||
6 | find_package(libxml2 REQUIRED) | ||
7 | |||
8 | include_directories(${sqlite3_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) | ||
9 | add_executable(generator generator.cpp) | ||
10 | set_property(TARGET generator PROPERTY CXX_STANDARD 11) | ||
11 | set_property(TARGET generator PROPERTY CXX_STANDARD_REQUIRED ON) | ||
12 | target_link_libraries(generator ${sqlite3_LIBRARIES} ${LIBXML2_LIBRARIES}) | ||
diff --git a/generator.cpp b/verbly/generator/generator.cpp index 305d121..faef5f7 100644 --- a/generator.cpp +++ b/verbly/generator/generator.cpp | |||
@@ -459,6 +459,7 @@ int main(int argc, char** argv) | |||
459 | // - s: master list | 459 | // - s: master list |
460 | // - ant: antonymy (e.g. happy/sad, sad/happy, happiness/sadness) | 460 | // - ant: antonymy (e.g. happy/sad, sad/happy, happiness/sadness) |
461 | // - at: variation (e.g. a measurement can be standard or nonstandard) | 461 | // - at: variation (e.g. a measurement can be standard or nonstandard) |
462 | // - der: derivation (e.g. happy/happily, happily/happy) | ||
462 | // - hyp: hypernymy/hyponymy (e.g. color/red, color/blue) | 463 | // - hyp: hypernymy/hyponymy (e.g. color/red, color/blue) |
463 | // - ins: instantiation (do we need this? let's see) | 464 | // - ins: instantiation (do we need this? let's see) |
464 | // - mm: member meronymy/holonymy (e.g. family/mother, family/child) | 465 | // - mm: member meronymy/holonymy (e.g. family/mother, family/child) |
@@ -893,6 +894,148 @@ int main(int argc, char** argv) | |||
893 | } | 894 | } |
894 | } | 895 | } |
895 | 896 | ||
897 | // der table | ||
898 | { | ||
899 | std::ifstream wnderfile(wnpref + "wn_der.pl"); | ||
900 | if (!wnderfile.is_open()) | ||
901 | { | ||
902 | std::cout << "Invalid WordNet data directory." << std::endl; | ||
903 | print_usage(); | ||
904 | } | ||
905 | |||
906 | std::list<std::string> lines; | ||
907 | for (;;) | ||
908 | { | ||
909 | std::string line; | ||
910 | if (!getline(wnderfile, line)) | ||
911 | { | ||
912 | break; | ||
913 | } | ||
914 | |||
915 | if (line.back() == '\r') | ||
916 | { | ||
917 | line.pop_back(); | ||
918 | } | ||
919 | |||
920 | lines.push_back(line); | ||
921 | } | ||
922 | |||
923 | progress ppgs("Writing morphological derivation...", lines.size()); | ||
924 | for (auto line : lines) | ||
925 | { | ||
926 | ppgs.update(); | ||
927 | |||
928 | std::regex relation("^der\\(([134]\\d{8}),(\\d+),([134]\\d{8}),(\\d+)\\)\\."); | ||
929 | std::smatch relation_data; | ||
930 | if (!std::regex_search(line, relation_data, relation)) | ||
931 | { | ||
932 | continue; | ||
933 | } | ||
934 | |||
935 | int synset_id_1 = stoi(relation_data[1]); | ||
936 | int wnum_1 = stoi(relation_data[2]); | ||
937 | int synset_id_2 = stoi(relation_data[3]); | ||
938 | int wnum_2 = stoi(relation_data[4]); | ||
939 | std::string query; | ||
940 | switch (synset_id_1 / 100000000) | ||
941 | { | ||
942 | case 1: // Noun | ||
943 | { | ||
944 | switch (synset_id_2 / 100000000) | ||
945 | { | ||
946 | case 1: // Noun | ||
947 | { | ||
948 | query = "INSERT INTO noun_noun_derivation (noun_1_id, noun_2_id) VALUES (?, ?)"; | ||
949 | break; | ||
950 | } | ||
951 | |||
952 | case 3: // Adjective | ||
953 | { | ||
954 | query = "INSERT INTO noun_adjective_derivation (noun_id, adjective_id) VALUES (?, ?)"; | ||
955 | break; | ||
956 | } | ||
957 | |||
958 | case 4: // Adverb | ||
959 | { | ||
960 | query = "INSERT INTO noun_adverb_derivation (noun_id, adverb_id) VALUES (?, ?)"; | ||
961 | break; | ||
962 | } | ||
963 | } | ||
964 | |||
965 | break; | ||
966 | } | ||
967 | |||
968 | case 3: // Adjective | ||
969 | { | ||
970 | switch (synset_id_2 / 100000000) | ||
971 | { | ||
972 | case 1: // Noun | ||
973 | { | ||
974 | query = "INSERT INTO noun_adjective_derivation (adjective_id, noun_id) VALUES (?, ?)"; | ||
975 | break; | ||
976 | } | ||
977 | |||
978 | case 3: // Adjective | ||
979 | { | ||
980 | query = "INSERT INTO adjective_adjective_derivation (adjective_id, adjective_id) VALUES (?, ?)"; | ||
981 | break; | ||
982 | } | ||
983 | |||
984 | case 4: // Adverb | ||
985 | { | ||
986 | query = "INSERT INTO adjective_adverb_derivation (adjective_id, adverb_id) VALUES (?, ?)"; | ||
987 | break; | ||
988 | } | ||
989 | } | ||
990 | |||
991 | break; | ||
992 | } | ||
993 | |||
994 | case 4: // Adverb | ||
995 | { | ||
996 | switch (synset_id_2 / 100000000) | ||
997 | { | ||
998 | case 1: // Noun | ||
999 | { | ||
1000 | query = "INSERT INTO noun_adverb_derivation (adverb_id, noun_id) VALUES (?, ?)"; | ||
1001 | break; | ||
1002 | } | ||
1003 | |||
1004 | case 3: // Adjective | ||
1005 | { | ||
1006 | query = "INSERT INTO adjective_adverb_derivation (adverb_id, adjective_id) VALUES (?, ?)"; | ||
1007 | break; | ||
1008 | } | ||
1009 | |||
1010 | case 4: // Adverb | ||
1011 | { | ||
1012 | query = "INSERT INTO adverb_adverb_derivation (adverb_1_id, adverb_2_id) VALUES (?, ?)"; | ||
1013 | break; | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | break; | ||
1018 | } | ||
1019 | } | ||
1020 | |||
1021 | sqlite3_stmt* ppstmt; | ||
1022 | if (sqlite3_prepare_v2(ppdb, query.c_str(), query.size(), &ppstmt, NULL) != SQLITE_OK) | ||
1023 | { | ||
1024 | db_error(ppdb, query); | ||
1025 | } | ||
1026 | |||
1027 | sqlite3_bind_int(ppstmt, 1, wn[synset_id_1][wnum_1]); | ||
1028 | sqlite3_bind_int(ppstmt, 2, wn[synset_id_2][wnum_2]); | ||
1029 | |||
1030 | if (sqlite3_step(ppstmt) != SQLITE_DONE) | ||
1031 | { | ||
1032 | db_error(ppdb, query); | ||
1033 | } | ||
1034 | |||
1035 | sqlite3_finalize(ppstmt); | ||
1036 | } | ||
1037 | } | ||
1038 | |||
896 | // hyp table | 1039 | // hyp table |
897 | { | 1040 | { |
898 | std::ifstream wnhypfile(wnpref + "wn_hyp.pl"); | 1041 | std::ifstream wnhypfile(wnpref + "wn_hyp.pl"); |
@@ -1375,7 +1518,7 @@ int main(int argc, char** argv) | |||
1375 | sqlite3_finalize(ppstmt); | 1518 | sqlite3_finalize(ppstmt); |
1376 | } | 1519 | } |
1377 | } | 1520 | } |
1378 | /* | 1521 | |
1379 | // sim table | 1522 | // sim table |
1380 | { | 1523 | { |
1381 | std::ifstream wnsimfile(wnpref + "wn_sim.pl"); | 1524 | std::ifstream wnsimfile(wnpref + "wn_sim.pl"); |
@@ -1452,7 +1595,7 @@ int main(int argc, char** argv) | |||
1452 | } | 1595 | } |
1453 | } | 1596 | } |
1454 | } | 1597 | } |
1455 | */ | 1598 | |
1456 | // syntax table | 1599 | // syntax table |
1457 | { | 1600 | { |
1458 | std::ifstream wnsyntaxfile(wnpref + "wn_syntax.pl"); | 1601 | std::ifstream wnsyntaxfile(wnpref + "wn_syntax.pl"); |
diff --git a/progress.h b/verbly/generator/progress.h index 81f07a3..81f07a3 100644 --- a/progress.h +++ b/verbly/generator/progress.h | |||
diff --git a/schema.sql b/verbly/generator/schema.sql index fd55734..b4efe0a 100644 --- a/schema.sql +++ b/verbly/generator/schema.sql | |||
@@ -202,3 +202,51 @@ CREATE TABLE `adverb_pronunciations` ( | |||
202 | `pronunciation` VARCHAR(64) NOT NULL, | 202 | `pronunciation` VARCHAR(64) NOT NULL, |
203 | FOREIGN KEY (`adverb_id`) REFERENCES `adverbs`(`adverb_id`) | 203 | FOREIGN KEY (`adverb_id`) REFERENCES `adverbs`(`adverb_id`) |
204 | ); | 204 | ); |
205 | |||
206 | DROP TABLE IF EXISTS `noun_noun_derivation`; | ||
207 | CREATE TABLE `noun_noun_derivation` ( | ||
208 | `noun_1_id` INTEGER NOT NULL, | ||
209 | `noun_2_id` INTEGER NOT NULL, | ||
210 | FOREIGN KEY (`noun_1_id`) REFERENCES `nouns`(`noun_id`), | ||
211 | FOREIGN KEY (`noun_2_id`) REFERENCES `nouns`(`noun_id`) | ||
212 | ); | ||
213 | |||
214 | DROP TABLE IF EXISTS `noun_adjective_derivation`; | ||
215 | CREATE TABLE `noun_adjective_derivation` ( | ||
216 | `noun_id` INTEGER NOT NULL, | ||
217 | `adjective_id` INTEGER NOT NULL, | ||
218 | FOREIGN KEY (`noun_id`) REFERENCES `nouns`(`noun_id`), | ||
219 | FOREIGN KEY (`adjective_id`) REFERENCES `adjectives`(`adjective_id`) | ||
220 | ); | ||
221 | |||
222 | DROP TABLE IF EXISTS `noun_adverb_derivation`; | ||
223 | CREATE TABLE `noun_adverb_derivation` ( | ||
224 | `noun_id` INTEGER NOT NULL, | ||
225 | `adverb_id` INTEGER NOT NULL, | ||
226 | FOREIGN KEY (`noun_id`) REFERENCES `nouns`(`noun_id`), | ||
227 | FOREIGN KEY (`adverb_id`) REFERENCES `adverbs`(`adverb_id`) | ||
228 | ); | ||
229 | |||
230 | DROP TABLE IF EXISTS `adjective_adjective_derivation`; | ||
231 | CREATE TABLE `adjective_adjective_derivation` ( | ||
232 | `adjective_1_id` INTEGER NOT NULL, | ||
233 | `adjective_2_id` INTEGER NOT NULL, | ||
234 | FOREIGN KEY (`adjective_1_id`) REFERENCES `adjectives`(`adjective_id`), | ||
235 | FOREIGN KEY (`adjective_2_id`) REFERENCES `adjectives`(`adjective_id`) | ||
236 | ); | ||
237 | |||
238 | DROP TABLE IF EXISTS `adjective_adverb_derivation`; | ||
239 | CREATE TABLE `adjective_adverb_derivation` ( | ||
240 | `adjective_id` INTEGER NOT NULL, | ||
241 | `adverb_id` INTEGER NOT NULL, | ||
242 | FOREIGN KEY (`adjective_id`) REFERENCES `adjectives`(`adjective_id`), | ||
243 | FOREIGN KEY (`adverb_id`) REFERENCES `adverbs`(`adjective_id`) | ||
244 | ); | ||
245 | |||
246 | DROP TABLE IF EXISTS `adverb_adverb_derivation`; | ||
247 | CREATE TABLE `adverb_adverb_derivation` ( | ||
248 | `adverb_1_id` INTEGER NOT NULL, | ||
249 | `adverb_2_id` INTEGER NOT NULL, | ||
250 | FOREIGN KEY (`adverb_1_id`) REFERENCES `adverbs`(`adverb_id`), | ||
251 | FOREIGN KEY (`adverb_2_id`) REFERENCES `adverbs`(`adverb_id`) | ||
252 | ); | ||
diff --git a/verbly/adjective.cpp b/verbly/lib/adjective.cpp index 0f4087f..b2b53e4 100644 --- a/verbly/adjective.cpp +++ b/verbly/lib/adjective.cpp | |||
@@ -261,6 +261,38 @@ namespace verbly { | |||
261 | return *this; | 261 | return *this; |
262 | } | 262 | } |
263 | 263 | ||
264 | adjective_query& adjective_query::derived_from(const word& _w) | ||
265 | { | ||
266 | if (dynamic_cast<const adjective*>(&_w) != nullptr) | ||
267 | { | ||
268 | _derived_from_adjective.push_back(dynamic_cast<const adjective&>(_w)); | ||
269 | } else if (dynamic_cast<const adverb*>(&_w) != nullptr) | ||
270 | { | ||
271 | _derived_from_adverb.push_back(dynamic_cast<const adverb&>(_w)); | ||
272 | } else if (dynamic_cast<const noun*>(&_w) != nullptr) | ||
273 | { | ||
274 | _derived_from_noun.push_back(dynamic_cast<const noun&>(_w)); | ||
275 | } | ||
276 | |||
277 | return *this; | ||
278 | } | ||
279 | |||
280 | adjective_query& adjective_query::not_derived_from(const word& _w) | ||
281 | { | ||
282 | if (dynamic_cast<const adjective*>(&_w) != nullptr) | ||
283 | { | ||
284 | _not_derived_from_adjective.push_back(dynamic_cast<const adjective&>(_w)); | ||
285 | } else if (dynamic_cast<const adverb*>(&_w) != nullptr) | ||
286 | { | ||
287 | _not_derived_from_adverb.push_back(dynamic_cast<const adverb&>(_w)); | ||
288 | } else if (dynamic_cast<const noun*>(&_w) != nullptr) | ||
289 | { | ||
290 | _not_derived_from_noun.push_back(dynamic_cast<const noun&>(_w)); | ||
291 | } | ||
292 | |||
293 | return *this; | ||
294 | } | ||
295 | |||
264 | std::list<adjective> adjective_query::run() const | 296 | std::list<adjective> adjective_query::run() const |
265 | { | 297 | { |
266 | std::stringstream construct; | 298 | std::stringstream construct; |
@@ -423,6 +455,48 @@ namespace verbly { | |||
423 | conditions.push_back(cond); | 455 | conditions.push_back(cond); |
424 | } | 456 | } |
425 | 457 | ||
458 | if (!_derived_from_adjective.empty()) | ||
459 | { | ||
460 | std::list<std::string> clauses(_derived_from_adjective.size(), "adjective_2_id = @DERADJ"); | ||
461 | std::string cond = "adjective_id IN (SELECT adjective_1_id FROM adjective_adjective_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
462 | conditions.push_back(cond); | ||
463 | } | ||
464 | |||
465 | if (!_not_derived_from_adjective.empty()) | ||
466 | { | ||
467 | std::list<std::string> clauses(_not_derived_from_adjective.size(), "adjective_2_id = @NDERADJ"); | ||
468 | std::string cond = "adjective_id NOT IN (SELECT adjective_1_id FROM adjective_adjective_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
469 | conditions.push_back(cond); | ||
470 | } | ||
471 | |||
472 | if (!_derived_from_adverb.empty()) | ||
473 | { | ||
474 | std::list<std::string> clauses(_derived_from_adverb.size(), "adverb_id = @DERADV"); | ||
475 | std::string cond = "adjective_id IN (SELECT adjective_id FROM adjective_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
476 | conditions.push_back(cond); | ||
477 | } | ||
478 | |||
479 | if (!_not_derived_from_adverb.empty()) | ||
480 | { | ||
481 | std::list<std::string> clauses(_not_derived_from_adverb.size(), "adverb_id = @NDERADV"); | ||
482 | std::string cond = "adjective_id NOT IN (SELECT adjective_id FROM adjective_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
483 | conditions.push_back(cond); | ||
484 | } | ||
485 | |||
486 | if (!_derived_from_noun.empty()) | ||
487 | { | ||
488 | std::list<std::string> clauses(_derived_from_noun.size(), "noun_id = @DERN"); | ||
489 | std::string cond = "adjective_id IN (SELECT adjective_id FROM noun_adjective_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
490 | conditions.push_back(cond); | ||
491 | } | ||
492 | |||
493 | if (!_not_derived_from_noun.empty()) | ||
494 | { | ||
495 | std::list<std::string> clauses(_not_derived_from_noun.size(), "noun_id = @NDERN"); | ||
496 | std::string cond = "adjective_id NOT IN (SELECT adjective_id FROM noun_adjective_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
497 | conditions.push_back(cond); | ||
498 | } | ||
499 | |||
426 | if (!conditions.empty()) | 500 | if (!conditions.empty()) |
427 | { | 501 | { |
428 | construct << " WHERE "; | 502 | construct << " WHERE "; |
@@ -522,6 +596,36 @@ namespace verbly { | |||
522 | { | 596 | { |
523 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@MANID"), mannernym._id); | 597 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@MANID"), mannernym._id); |
524 | } | 598 | } |
599 | |||
600 | for (auto adj : _derived_from_adjective) | ||
601 | { | ||
602 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERADJ"), adj._id); | ||
603 | } | ||
604 | |||
605 | for (auto adj : _not_derived_from_adjective) | ||
606 | { | ||
607 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERADJ"), adj._id); | ||
608 | } | ||
609 | |||
610 | for (auto adv : _derived_from_adverb) | ||
611 | { | ||
612 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERADV"), adv._id); | ||
613 | } | ||
614 | |||
615 | for (auto adv : _not_derived_from_adverb) | ||
616 | { | ||
617 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERADV"), adv._id); | ||
618 | } | ||
619 | |||
620 | for (auto n : _derived_from_noun) | ||
621 | { | ||
622 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERN"), n._id); | ||
623 | } | ||
624 | |||
625 | for (auto n : _not_derived_from_noun) | ||
626 | { | ||
627 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERN"), n._id); | ||
628 | } | ||
525 | 629 | ||
526 | std::list<adjective> output; | 630 | std::list<adjective> output; |
527 | while (sqlite3_step(ppstmt) == SQLITE_ROW) | 631 | while (sqlite3_step(ppstmt) == SQLITE_ROW) |
diff --git a/verbly/adjective.h b/verbly/lib/adjective.h index 4927d59..3dcab9b 100644 --- a/verbly/adjective.h +++ b/verbly/lib/adjective.h | |||
@@ -85,6 +85,9 @@ namespace verbly { | |||
85 | adjective_query& is_mannernymic(bool _is_mannernymic); | 85 | adjective_query& is_mannernymic(bool _is_mannernymic); |
86 | adjective_query& anti_mannernym_of(const adverb& _adv); | 86 | adjective_query& anti_mannernym_of(const adverb& _adv); |
87 | 87 | ||
88 | adjective_query& derived_from(const word& _w); | ||
89 | adjective_query& not_derived_from(const word& _w); | ||
90 | |||
88 | std::list<adjective> run() const; | 91 | std::list<adjective> run() const; |
89 | 92 | ||
90 | const static int unlimited = -1; | 93 | const static int unlimited = -1; |
@@ -126,6 +129,13 @@ namespace verbly { | |||
126 | 129 | ||
127 | bool _is_mannernymic = false; | 130 | bool _is_mannernymic = false; |
128 | std::list<adverb> _anti_mannernym_of; | 131 | std::list<adverb> _anti_mannernym_of; |
132 | |||
133 | std::list<adjective> _derived_from_adjective; | ||
134 | std::list<adjective> _not_derived_from_adjective; | ||
135 | std::list<adverb> _derived_from_adverb; | ||
136 | std::list<adverb> _not_derived_from_adverb; | ||
137 | std::list<noun> _derived_from_noun; | ||
138 | std::list<noun> _not_derived_from_noun; | ||
129 | }; | 139 | }; |
130 | 140 | ||
131 | }; | 141 | }; |
diff --git a/verbly/adverb.cpp b/verbly/lib/adverb.cpp index 9bb5a0d..8fcddad 100644 --- a/verbly/adverb.cpp +++ b/verbly/lib/adverb.cpp | |||
@@ -168,6 +168,38 @@ namespace verbly { | |||
168 | return *this; | 168 | return *this; |
169 | } | 169 | } |
170 | 170 | ||
171 | adverb_query& adverb_query::derived_from(const word& _w) | ||
172 | { | ||
173 | if (dynamic_cast<const adjective*>(&_w) != nullptr) | ||
174 | { | ||
175 | _derived_from_adjective.push_back(dynamic_cast<const adjective&>(_w)); | ||
176 | } else if (dynamic_cast<const adverb*>(&_w) != nullptr) | ||
177 | { | ||
178 | _derived_from_adverb.push_back(dynamic_cast<const adverb&>(_w)); | ||
179 | } else if (dynamic_cast<const noun*>(&_w) != nullptr) | ||
180 | { | ||
181 | _derived_from_noun.push_back(dynamic_cast<const noun&>(_w)); | ||
182 | } | ||
183 | |||
184 | return *this; | ||
185 | } | ||
186 | |||
187 | adverb_query& adverb_query::not_derived_from(const word& _w) | ||
188 | { | ||
189 | if (dynamic_cast<const adjective*>(&_w) != nullptr) | ||
190 | { | ||
191 | _not_derived_from_adjective.push_back(dynamic_cast<const adjective&>(_w)); | ||
192 | } else if (dynamic_cast<const adverb*>(&_w) != nullptr) | ||
193 | { | ||
194 | _not_derived_from_adverb.push_back(dynamic_cast<const adverb&>(_w)); | ||
195 | } else if (dynamic_cast<const noun*>(&_w) != nullptr) | ||
196 | { | ||
197 | _not_derived_from_noun.push_back(dynamic_cast<const noun&>(_w)); | ||
198 | } | ||
199 | |||
200 | return *this; | ||
201 | } | ||
202 | |||
171 | std::list<adverb> adverb_query::run() const | 203 | std::list<adverb> adverb_query::run() const |
172 | { | 204 | { |
173 | std::stringstream construct; | 205 | std::stringstream construct; |
@@ -251,6 +283,48 @@ namespace verbly { | |||
251 | conditions.push_back(cond); | 283 | conditions.push_back(cond); |
252 | } | 284 | } |
253 | 285 | ||
286 | if (!_derived_from_adjective.empty()) | ||
287 | { | ||
288 | std::list<std::string> clauses(_derived_from_adjective.size(), "adjective_id = @DERADJ"); | ||
289 | std::string cond = "adverb_id IN (SELECT adverb_id FROM adjective_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
290 | conditions.push_back(cond); | ||
291 | } | ||
292 | |||
293 | if (!_not_derived_from_adjective.empty()) | ||
294 | { | ||
295 | std::list<std::string> clauses(_not_derived_from_adjective.size(), "adjective_id = @NDERADJ"); | ||
296 | std::string cond = "adverb_id NOT IN (SELECT adverb_id FROM adjective_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
297 | conditions.push_back(cond); | ||
298 | } | ||
299 | |||
300 | if (!_derived_from_adverb.empty()) | ||
301 | { | ||
302 | std::list<std::string> clauses(_derived_from_adverb.size(), "adverb_2_id = @DERADV"); | ||
303 | std::string cond = "adverb_id IN (SELECT adverb_1_id FROM adverb_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
304 | conditions.push_back(cond); | ||
305 | } | ||
306 | |||
307 | if (!_not_derived_from_adverb.empty()) | ||
308 | { | ||
309 | std::list<std::string> clauses(_not_derived_from_adverb.size(), "adverb_2_id = @NDERADV"); | ||
310 | std::string cond = "adverb_id NOT IN (SELECT adverb_1_id FROM adverb_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
311 | conditions.push_back(cond); | ||
312 | } | ||
313 | |||
314 | if (!_derived_from_noun.empty()) | ||
315 | { | ||
316 | std::list<std::string> clauses(_derived_from_noun.size(), "noun_id = @DERN"); | ||
317 | std::string cond = "adverb_id IN (SELECT adverb_id FROM noun_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
318 | conditions.push_back(cond); | ||
319 | } | ||
320 | |||
321 | if (!_not_derived_from_noun.empty()) | ||
322 | { | ||
323 | std::list<std::string> clauses(_not_derived_from_noun.size(), "noun_id = @NDERN"); | ||
324 | std::string cond = "adverb_id NOT IN (SELECT adverb_id FROM noun_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
325 | conditions.push_back(cond); | ||
326 | } | ||
327 | |||
254 | if (!conditions.empty()) | 328 | if (!conditions.empty()) |
255 | { | 329 | { |
256 | construct << " WHERE "; | 330 | construct << " WHERE "; |
@@ -315,6 +389,36 @@ namespace verbly { | |||
315 | { | 389 | { |
316 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@AMANID"), adj._id); | 390 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@AMANID"), adj._id); |
317 | } | 391 | } |
392 | |||
393 | for (auto adj : _derived_from_adjective) | ||
394 | { | ||
395 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERADJ"), adj._id); | ||
396 | } | ||
397 | |||
398 | for (auto adj : _not_derived_from_adjective) | ||
399 | { | ||
400 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERADJ"), adj._id); | ||
401 | } | ||
402 | |||
403 | for (auto adv : _derived_from_adverb) | ||
404 | { | ||
405 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERADV"), adv._id); | ||
406 | } | ||
407 | |||
408 | for (auto adv : _not_derived_from_adverb) | ||
409 | { | ||
410 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERADV"), adv._id); | ||
411 | } | ||
412 | |||
413 | for (auto n : _derived_from_noun) | ||
414 | { | ||
415 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERN"), n._id); | ||
416 | } | ||
417 | |||
418 | for (auto n : _not_derived_from_noun) | ||
419 | { | ||
420 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERN"), n._id); | ||
421 | } | ||
318 | 422 | ||
319 | std::list<adverb> output; | 423 | std::list<adverb> output; |
320 | while (sqlite3_step(ppstmt) == SQLITE_ROW) | 424 | while (sqlite3_step(ppstmt) == SQLITE_ROW) |
diff --git a/verbly/adverb.h b/verbly/lib/adverb.h index 42c3492..65e3c5c 100644 --- a/verbly/adverb.h +++ b/verbly/lib/adverb.h | |||
@@ -24,6 +24,9 @@ namespace verbly { | |||
24 | adverb_query antonyms() const; | 24 | adverb_query antonyms() const; |
25 | adverb_query synonyms() const; | 25 | adverb_query synonyms() const; |
26 | adjective_query anti_mannernyms() const; | 26 | adjective_query anti_mannernyms() const; |
27 | |||
28 | adverb_query& derived_from(const word& _w); | ||
29 | adverb_query& not_derived_from(const word& _w); | ||
27 | }; | 30 | }; |
28 | 31 | ||
29 | class adverb_query { | 32 | class adverb_query { |
@@ -50,6 +53,9 @@ namespace verbly { | |||
50 | adverb_query& is_mannernymic(bool _arg); | 53 | adverb_query& is_mannernymic(bool _arg); |
51 | adverb_query& mannernym_of(const adjective& _adj); | 54 | adverb_query& mannernym_of(const adjective& _adj); |
52 | 55 | ||
56 | adverb_query& derived_from(const word& _w); | ||
57 | adverb_query& not_derived_from(const word& _w); | ||
58 | |||
53 | std::list<adverb> run() const; | 59 | std::list<adverb> run() const; |
54 | 60 | ||
55 | const static int unlimited = -1; | 61 | const static int unlimited = -1; |
@@ -75,6 +81,13 @@ namespace verbly { | |||
75 | 81 | ||
76 | bool _is_mannernymic = false; | 82 | bool _is_mannernymic = false; |
77 | std::list<adjective> _mannernym_of; | 83 | std::list<adjective> _mannernym_of; |
84 | |||
85 | std::list<adjective> _derived_from_adjective; | ||
86 | std::list<adjective> _not_derived_from_adjective; | ||
87 | std::list<adverb> _derived_from_adverb; | ||
88 | std::list<adverb> _not_derived_from_adverb; | ||
89 | std::list<noun> _derived_from_noun; | ||
90 | std::list<noun> _not_derived_from_noun; | ||
78 | }; | 91 | }; |
79 | 92 | ||
80 | }; | 93 | }; |
diff --git a/verbly/c++14.h b/verbly/lib/c++14.h index b3efbe2..b3efbe2 100644 --- a/verbly/c++14.h +++ b/verbly/lib/c++14.h | |||
diff --git a/verbly/data.cpp b/verbly/lib/data.cpp index 57a8850..57a8850 100644 --- a/verbly/data.cpp +++ b/verbly/lib/data.cpp | |||
diff --git a/verbly/data.h b/verbly/lib/data.h index 37092d7..37092d7 100644 --- a/verbly/data.h +++ b/verbly/lib/data.h | |||
diff --git a/verbly/noun.cpp b/verbly/lib/noun.cpp index 9336a1c..43fda2e 100644 --- a/verbly/noun.cpp +++ b/verbly/lib/noun.cpp | |||
@@ -323,6 +323,13 @@ namespace verbly { | |||
323 | return *this; | 323 | return *this; |
324 | } | 324 | } |
325 | 325 | ||
326 | noun_query& noun_query::is_not_proper(bool _arg) | ||
327 | { | ||
328 | _is_not_proper = _arg; | ||
329 | |||
330 | return *this; | ||
331 | } | ||
332 | |||
326 | noun_query& noun_query::instance_of(const noun& _noun) | 333 | noun_query& noun_query::instance_of(const noun& _noun) |
327 | { | 334 | { |
328 | _instance_of.push_back(_noun); | 335 | _instance_of.push_back(_noun); |
@@ -428,6 +435,38 @@ namespace verbly { | |||
428 | return *this; | 435 | return *this; |
429 | } | 436 | } |
430 | 437 | ||
438 | noun_query& noun_query::derived_from(const word& _w) | ||
439 | { | ||
440 | if (dynamic_cast<const adjective*>(&_w) != nullptr) | ||
441 | { | ||
442 | _derived_from_adjective.push_back(dynamic_cast<const adjective&>(_w)); | ||
443 | } else if (dynamic_cast<const adverb*>(&_w) != nullptr) | ||
444 | { | ||
445 | _derived_from_adverb.push_back(dynamic_cast<const adverb&>(_w)); | ||
446 | } else if (dynamic_cast<const noun*>(&_w) != nullptr) | ||
447 | { | ||
448 | _derived_from_noun.push_back(dynamic_cast<const noun&>(_w)); | ||
449 | } | ||
450 | |||
451 | return *this; | ||
452 | } | ||
453 | |||
454 | noun_query& noun_query::not_derived_from(const word& _w) | ||
455 | { | ||
456 | if (dynamic_cast<const adjective*>(&_w) != nullptr) | ||
457 | { | ||
458 | _not_derived_from_adjective.push_back(dynamic_cast<const adjective&>(_w)); | ||
459 | } else if (dynamic_cast<const adverb*>(&_w) != nullptr) | ||
460 | { | ||
461 | _not_derived_from_adverb.push_back(dynamic_cast<const adverb&>(_w)); | ||
462 | } else if (dynamic_cast<const noun*>(&_w) != nullptr) | ||
463 | { | ||
464 | _not_derived_from_noun.push_back(dynamic_cast<const noun&>(_w)); | ||
465 | } | ||
466 | |||
467 | return *this; | ||
468 | } | ||
469 | |||
431 | std::list<noun> noun_query::run() const | 470 | std::list<noun> noun_query::run() const |
432 | { | 471 | { |
433 | std::stringstream construct; | 472 | std::stringstream construct; |
@@ -608,6 +647,11 @@ namespace verbly { | |||
608 | conditions.push_back("noun_id IN (SELECT instance_id FROM instantiation)"); | 647 | conditions.push_back("noun_id IN (SELECT instance_id FROM instantiation)"); |
609 | } | 648 | } |
610 | 649 | ||
650 | if (_is_not_proper) | ||
651 | { | ||
652 | conditions.push_back("noun_id NOT IN (SELECT instance_id FROM instantiation)"); | ||
653 | } | ||
654 | |||
611 | if (!_instance_of.empty()) | 655 | if (!_instance_of.empty()) |
612 | { | 656 | { |
613 | std::list<std::string> clauses(_instance_of.size(), "class_id = @CLSID"); | 657 | std::list<std::string> clauses(_instance_of.size(), "class_id = @CLSID"); |
@@ -703,6 +747,48 @@ namespace verbly { | |||
703 | conditions.push_back(cond); | 747 | conditions.push_back(cond); |
704 | } | 748 | } |
705 | 749 | ||
750 | if (!_derived_from_adjective.empty()) | ||
751 | { | ||
752 | std::list<std::string> clauses(_derived_from_adjective.size(), "adjective_id = @DERADJ"); | ||
753 | std::string cond = "noun_id IN (SELECT noun_id FROM noun_adjective_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
754 | conditions.push_back(cond); | ||
755 | } | ||
756 | |||
757 | if (!_not_derived_from_adjective.empty()) | ||
758 | { | ||
759 | std::list<std::string> clauses(_not_derived_from_adjective.size(), "adjective_id = @NDERADJ"); | ||
760 | std::string cond = "noun_id NOT IN (SELECT noun_id FROM noun_adjective_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
761 | conditions.push_back(cond); | ||
762 | } | ||
763 | |||
764 | if (!_derived_from_adverb.empty()) | ||
765 | { | ||
766 | std::list<std::string> clauses(_derived_from_adverb.size(), "adverb_id = @DERADV"); | ||
767 | std::string cond = "noun_id IN (SELECT noun_id FROM noun_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
768 | conditions.push_back(cond); | ||
769 | } | ||
770 | |||
771 | if (!_not_derived_from_adverb.empty()) | ||
772 | { | ||
773 | std::list<std::string> clauses(_not_derived_from_adverb.size(), "adverb_id = @NDERADV"); | ||
774 | std::string cond = "noun_id NOT IN (SELECT noun_id FROM noun_adverb_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
775 | conditions.push_back(cond); | ||
776 | } | ||
777 | |||
778 | if (!_derived_from_noun.empty()) | ||
779 | { | ||
780 | std::list<std::string> clauses(_derived_from_noun.size(), "noun_2_id = @DERN"); | ||
781 | std::string cond = "noun_id IN (SELECT noun_1_id FROM noun_noun_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
782 | conditions.push_back(cond); | ||
783 | } | ||
784 | |||
785 | if (!_not_derived_from_noun.empty()) | ||
786 | { | ||
787 | std::list<std::string> clauses(_not_derived_from_noun.size(), "noun_2_id = @NDERN"); | ||
788 | std::string cond = "noun_id NOT IN (SELECT noun_1_id FROM noun_noun_derivation WHERE " + verbly::implode(std::begin(clauses), std::end(clauses), " OR ") + ")"; | ||
789 | conditions.push_back(cond); | ||
790 | } | ||
791 | |||
706 | if (!conditions.empty()) | 792 | if (!conditions.empty()) |
707 | { | 793 | { |
708 | construct << " WHERE "; | 794 | construct << " WHERE "; |
@@ -872,6 +958,36 @@ namespace verbly { | |||
872 | { | 958 | { |
873 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@VALID"), value._id); | 959 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@VALID"), value._id); |
874 | } | 960 | } |
961 | |||
962 | for (auto adj : _derived_from_adjective) | ||
963 | { | ||
964 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERADJ"), adj._id); | ||
965 | } | ||
966 | |||
967 | for (auto adj : _not_derived_from_adjective) | ||
968 | { | ||
969 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERADJ"), adj._id); | ||
970 | } | ||
971 | |||
972 | for (auto adv : _derived_from_adverb) | ||
973 | { | ||
974 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERADV"), adv._id); | ||
975 | } | ||
976 | |||
977 | for (auto adv : _not_derived_from_adverb) | ||
978 | { | ||
979 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERADV"), adv._id); | ||
980 | } | ||
981 | |||
982 | for (auto n : _derived_from_noun) | ||
983 | { | ||
984 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@DERN"), n._id); | ||
985 | } | ||
986 | |||
987 | for (auto n : _not_derived_from_noun) | ||
988 | { | ||
989 | sqlite3_bind_int(ppstmt, sqlite3_bind_parameter_index(ppstmt, "@NDERN"), n._id); | ||
990 | } | ||
875 | 991 | ||
876 | std::list<noun> output; | 992 | std::list<noun> output; |
877 | while (sqlite3_step(ppstmt) == SQLITE_ROW) | 993 | while (sqlite3_step(ppstmt) == SQLITE_ROW) |
diff --git a/verbly/noun.h b/verbly/lib/noun.h index f5ba256..da76866 100644 --- a/verbly/noun.h +++ b/verbly/lib/noun.h | |||
@@ -78,6 +78,7 @@ namespace verbly { | |||
78 | noun_query& not_member_holonym_of(const noun& _noun); | 78 | noun_query& not_member_holonym_of(const noun& _noun); |
79 | 79 | ||
80 | noun_query& is_proper(bool _arg); | 80 | noun_query& is_proper(bool _arg); |
81 | noun_query& is_not_proper(bool _arg); | ||
81 | noun_query& instance_of(const noun& _noun); | 82 | noun_query& instance_of(const noun& _noun); |
82 | noun_query& not_instance_of(const noun& _noun); | 83 | noun_query& not_instance_of(const noun& _noun); |
83 | 84 | ||
@@ -99,6 +100,9 @@ namespace verbly { | |||
99 | noun_query& is_attribute(bool _arg); | 100 | noun_query& is_attribute(bool _arg); |
100 | noun_query& attribute_of(const adjective& _adj); | 101 | noun_query& attribute_of(const adjective& _adj); |
101 | 102 | ||
103 | noun_query& derived_from(const word& _w); | ||
104 | noun_query& not_derived_from(const word& _w); | ||
105 | |||
102 | std::list<noun> run() const; | 106 | std::list<noun> run() const; |
103 | 107 | ||
104 | const static int unlimited = -1; | 108 | const static int unlimited = -1; |
@@ -144,6 +148,7 @@ namespace verbly { | |||
144 | std::list<noun> _not_member_holonym_of; | 148 | std::list<noun> _not_member_holonym_of; |
145 | 149 | ||
146 | bool _is_proper = false; | 150 | bool _is_proper = false; |
151 | bool _is_not_proper = false; | ||
147 | std::list<noun> _instance_of; | 152 | std::list<noun> _instance_of; |
148 | std::list<noun> _not_instance_of; | 153 | std::list<noun> _not_instance_of; |
149 | 154 | ||
@@ -164,6 +169,13 @@ namespace verbly { | |||
164 | 169 | ||
165 | bool _is_attribute = false; | 170 | bool _is_attribute = false; |
166 | std::list<adjective> _attribute_of; | 171 | std::list<adjective> _attribute_of; |
172 | |||
173 | std::list<adjective> _derived_from_adjective; | ||
174 | std::list<adjective> _not_derived_from_adjective; | ||
175 | std::list<adverb> _derived_from_adverb; | ||
176 | std::list<adverb> _not_derived_from_adverb; | ||
177 | std::list<noun> _derived_from_noun; | ||
178 | std::list<noun> _not_derived_from_noun; | ||
167 | }; | 179 | }; |
168 | 180 | ||
169 | }; | 181 | }; |
diff --git a/verbly/token.cpp b/verbly/lib/token.cpp index aa8f50e..aa8f50e 100644 --- a/verbly/token.cpp +++ b/verbly/lib/token.cpp | |||
diff --git a/verbly/token.h b/verbly/lib/token.h index 44d99cb..44d99cb 100644 --- a/verbly/token.h +++ b/verbly/lib/token.h | |||
diff --git a/verbly/util.h b/verbly/lib/util.h index 815b47c..815b47c 100644 --- a/verbly/util.h +++ b/verbly/lib/util.h | |||
diff --git a/verbly/verb.cpp b/verbly/lib/verb.cpp index 23f7c92..23f7c92 100644 --- a/verbly/verb.cpp +++ b/verbly/lib/verb.cpp | |||
diff --git a/verbly/verb.h b/verbly/lib/verb.h index 7cc87e2..7cc87e2 100644 --- a/verbly/verb.h +++ b/verbly/lib/verb.h | |||
diff --git a/verbly/verbly.h b/verbly/lib/verbly.h index b9f5367..b9f5367 100644 --- a/verbly/verbly.h +++ b/verbly/lib/verbly.h | |||
diff --git a/verbly/word.cpp b/verbly/lib/word.cpp index c50e7d3..c50e7d3 100644 --- a/verbly/word.cpp +++ b/verbly/lib/word.cpp | |||
diff --git a/verbly/word.h b/verbly/lib/word.h index 23ddb2b..23ddb2b 100644 --- a/verbly/word.h +++ b/verbly/lib/word.h | |||