From e4fa0cb86d97c23c24cd7bdd62c23f03eed312da Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 5 Feb 2017 08:56:39 -0500 Subject: 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. --- lib/part.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'lib/part.h') 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 @@ #include #include #include -#include "selrestr.h" #include "field.h" #include "filter.h" #include "enums.h" @@ -21,7 +20,7 @@ namespace verbly { // Static factories - static part createNounPhrase(std::string role, selrestr selrestrs, std::set synrestrs); + static part createNounPhrase(std::string role, std::set selrestrs, std::set synrestrs); static part createVerb(); @@ -77,7 +76,7 @@ namespace verbly { std::string getNounRole() const; - selrestr getNounSelrestrs() const; + std::set getNounSelrestrs() const; std::set getNounSynrestrs() const; @@ -110,8 +109,21 @@ namespace verbly { static const field frames; - // Noun synrestr relationship + // Noun selrestr and synrestr relationships + class selrestr_field { + public: + + filter operator%=(std::string selrestr) const; + + private: + + static const field selrestrJoin; + static const field selrestrField; + }; + + static const selrestr_field selrestrs; + class synrestr_field { public: @@ -138,7 +150,7 @@ namespace verbly { union { struct { std::string role; - selrestr selrestrs; + std::set selrestrs; std::set synrestrs; } noun_phrase_; struct { -- cgit 1.4.1