diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-02-05 08:56:39 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-02-05 08:56:39 -0500 |
commit | e4fa0cb86d97c23c24cd7bdd62c23f03eed312da (patch) | |
tree | 70a20fdf684b1724659196a7de8d21a4a6ca194f /lib/part.h | |
parent | bea3673ae1b3d19585dec56e96dbcd8a56b96e6d (diff) | |
download | verbly-e4fa0cb86d97c23c24cd7bdd62c23f03eed312da.tar.gz verbly-e4fa0cb86d97c23c24cd7bdd62c23f03eed312da.tar.bz2 verbly-e4fa0cb86d97c23c24cd7bdd62c23f03eed312da.zip |
Flattened selrestrs
Now, selrestrs are, instead of logically being a tree of positive/negative restrictions that are ANDed/ORed together, they are a flat set of positive restrictions that are ORed together. They are stored as strings in a table called selrestrs, just like synrestrs, which makes them a lot more queryable now as well. This change required some changes to the VerbNet data, because we needed to consolidate any ANDed clauses into single selrestrs, as well as convert any negative selrestrs into positive ones. The changes made are detailed on the wiki. Preposition choices are now encoded as comma-separated lists instead of using JSON. This change, along with the selrestrs one, allows us to remove verbly's dependency on nlohmann::json.
Diffstat (limited to 'lib/part.h')
-rw-r--r-- | lib/part.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/part.h b/lib/part.h index 7180f57..450db3d 100644 --- a/lib/part.h +++ b/lib/part.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #include <vector> | 5 | #include <vector> |
6 | #include <set> | 6 | #include <set> |
7 | #include <list> | 7 | #include <list> |
8 | #include "selrestr.h" | ||
9 | #include "field.h" | 8 | #include "field.h" |
10 | #include "filter.h" | 9 | #include "filter.h" |
11 | #include "enums.h" | 10 | #include "enums.h" |
@@ -21,7 +20,7 @@ namespace verbly { | |||
21 | 20 | ||
22 | // Static factories | 21 | // Static factories |
23 | 22 | ||
24 | static part createNounPhrase(std::string role, selrestr selrestrs, std::set<std::string> synrestrs); | 23 | static part createNounPhrase(std::string role, std::set<std::string> selrestrs, std::set<std::string> synrestrs); |
25 | 24 | ||
26 | static part createVerb(); | 25 | static part createVerb(); |
27 | 26 | ||
@@ -77,7 +76,7 @@ namespace verbly { | |||
77 | 76 | ||
78 | std::string getNounRole() const; | 77 | std::string getNounRole() const; |
79 | 78 | ||
80 | selrestr getNounSelrestrs() const; | 79 | std::set<std::string> getNounSelrestrs() const; |
81 | 80 | ||
82 | std::set<std::string> getNounSynrestrs() const; | 81 | std::set<std::string> getNounSynrestrs() const; |
83 | 82 | ||
@@ -110,8 +109,21 @@ namespace verbly { | |||
110 | 109 | ||
111 | static const field frames; | 110 | static const field frames; |
112 | 111 | ||
113 | // Noun synrestr relationship | 112 | // Noun selrestr and synrestr relationships |
114 | 113 | ||
114 | class selrestr_field { | ||
115 | public: | ||
116 | |||
117 | filter operator%=(std::string selrestr) const; | ||
118 | |||
119 | private: | ||
120 | |||
121 | static const field selrestrJoin; | ||
122 | static const field selrestrField; | ||
123 | }; | ||
124 | |||
125 | static const selrestr_field selrestrs; | ||
126 | |||
115 | class synrestr_field { | 127 | class synrestr_field { |
116 | public: | 128 | public: |
117 | 129 | ||
@@ -138,7 +150,7 @@ namespace verbly { | |||
138 | union { | 150 | union { |
139 | struct { | 151 | struct { |
140 | std::string role; | 152 | std::string role; |
141 | selrestr selrestrs; | 153 | std::set<std::string> selrestrs; |
142 | std::set<std::string> synrestrs; | 154 | std::set<std::string> synrestrs; |
143 | } noun_phrase_; | 155 | } noun_phrase_; |
144 | struct { | 156 | struct { |