diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-02 22:44:08 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-02 22:44:08 -0400 |
commit | 499dbc410174602a5985bd75b600fbec5cd086f1 (patch) | |
tree | 62c611c74156d16072051eb5378ef1303c27a1b5 /lib | |
parent | 3a225f5eb709262b9d44d49519136ea9a2a71000 (diff) | |
download | verbly-499dbc410174602a5985bd75b600fbec5cd086f1.tar.gz verbly-499dbc410174602a5985bd75b600fbec5cd086f1.tar.bz2 verbly-499dbc410174602a5985bd75b600fbec5cd086f1.zip |
Added "requires plural form" noun query predicate
Diffstat (limited to 'lib')
-rw-r--r-- | lib/noun_query.cpp | 12 | ||||
-rw-r--r-- | lib/noun_query.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/noun_query.cpp b/lib/noun_query.cpp index 83bb47d..04e567d 100644 --- a/lib/noun_query.cpp +++ b/lib/noun_query.cpp | |||
@@ -76,6 +76,13 @@ namespace verbly { | |||
76 | return *this; | 76 | return *this; |
77 | } | 77 | } |
78 | 78 | ||
79 | noun_query& noun_query::requires_plural_form() | ||
80 | { | ||
81 | _requires_plural_form = true; | ||
82 | |||
83 | return *this; | ||
84 | } | ||
85 | |||
79 | noun_query& noun_query::with_complexity(int _arg) | 86 | noun_query& noun_query::with_complexity(int _arg) |
80 | { | 87 | { |
81 | _with_complexity = _arg; | 88 | _with_complexity = _arg; |
@@ -484,6 +491,11 @@ namespace verbly { | |||
484 | conditions.push_back(cond); | 491 | conditions.push_back(cond); |
485 | } | 492 | } |
486 | 493 | ||
494 | if (_requires_plural_form) | ||
495 | { | ||
496 | conditions.push_back("plural IS NOT NULL"); | ||
497 | } | ||
498 | |||
487 | if (!_with_prefix.empty()) | 499 | if (!_with_prefix.empty()) |
488 | { | 500 | { |
489 | std::function<std::string (filter<std::string>, bool)> recur = [&] (filter<std::string> f, bool notlogic) -> std::string { | 501 | std::function<std::string (filter<std::string>, bool)> recur = [&] (filter<std::string> f, bool notlogic) -> std::string { |
diff --git a/lib/noun_query.h b/lib/noun_query.h index 5b73f8d..44a1c70 100644 --- a/lib/noun_query.h +++ b/lib/noun_query.h | |||
@@ -17,6 +17,8 @@ namespace verbly { | |||
17 | noun_query& with_prefix(filter<std::string> _f); | 17 | noun_query& with_prefix(filter<std::string> _f); |
18 | noun_query& with_suffix(filter<std::string> _f); | 18 | noun_query& with_suffix(filter<std::string> _f); |
19 | 19 | ||
20 | noun_query& requires_plural_form(); | ||
21 | |||
20 | noun_query& with_complexity(int _arg); | 22 | noun_query& with_complexity(int _arg); |
21 | 23 | ||
22 | noun_query& is_hypernym(); | 24 | noun_query& is_hypernym(); |
@@ -93,6 +95,8 @@ namespace verbly { | |||
93 | 95 | ||
94 | int _with_complexity = unlimited; | 96 | int _with_complexity = unlimited; |
95 | 97 | ||
98 | bool _requires_plural_form = false; | ||
99 | |||
96 | bool _is_hypernym = false; | 100 | bool _is_hypernym = false; |
97 | filter<noun> _hypernym_of; | 101 | filter<noun> _hypernym_of; |
98 | filter<noun> _full_hypernym_of; | 102 | filter<noun> _full_hypernym_of; |