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. --- generator/part.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'generator/part.cpp') diff --git a/generator/part.cpp b/generator/part.cpp index 07618a8..d3e6656 100644 --- a/generator/part.cpp +++ b/generator/part.cpp @@ -6,12 +6,12 @@ namespace verbly { int part::nextId_ = 0; - part part::createNounPhrase(std::string role, selrestr selrestrs, std::set synrestrs) + part part::createNounPhrase(std::string role, std::set selrestrs, std::set synrestrs) { part p(type::noun_phrase); new(&p.noun_phrase_.role) std::string(std::move(role)); - new(&p.noun_phrase_.selrestrs) selrestr(std::move(selrestrs)); + new(&p.noun_phrase_.selrestrs) std::set(std::move(selrestrs)); new(&p.noun_phrase_.synrestrs) std::set(std::move(synrestrs)); return p; @@ -60,7 +60,7 @@ namespace verbly { case type::noun_phrase: { new(&result.noun_phrase_.role) std::string(other.noun_phrase_.role); - new(&result.noun_phrase_.selrestrs) selrestr(other.noun_phrase_.selrestrs); + new(&result.noun_phrase_.selrestrs) std::set(other.noun_phrase_.selrestrs); new(&result.noun_phrase_.synrestrs) std::set(other.noun_phrase_.synrestrs); break; @@ -103,7 +103,7 @@ namespace verbly { case type::noun_phrase: { new(&noun_phrase_.role) std::string(other.noun_phrase_.role); - new(&noun_phrase_.selrestrs) selrestr(other.noun_phrase_.selrestrs); + new(&noun_phrase_.selrestrs) std::set(other.noun_phrase_.selrestrs); new(&noun_phrase_.synrestrs) std::set(other.noun_phrase_.synrestrs); break; @@ -153,7 +153,7 @@ namespace verbly { type tempType = first.type_; int tempId = first.id_; std::string tempRole; - selrestr tempSelrestrs; + std::set tempSelrestrs; std::set tempSynrestrs; std::set tempChoices; bool tempPrepLiteral; @@ -204,7 +204,7 @@ namespace verbly { case type::noun_phrase: { new(&first.noun_phrase_.role) std::string(std::move(second.noun_phrase_.role)); - new(&first.noun_phrase_.selrestrs) selrestr(std::move(second.noun_phrase_.selrestrs)); + new(&first.noun_phrase_.selrestrs) std::set(std::move(second.noun_phrase_.selrestrs)); new(&first.noun_phrase_.synrestrs) std::set(std::move(second.noun_phrase_.synrestrs)); break; @@ -244,7 +244,7 @@ namespace verbly { case type::noun_phrase: { new(&second.noun_phrase_.role) std::string(std::move(tempRole)); - new(&second.noun_phrase_.selrestrs) selrestr(std::move(tempSelrestrs)); + new(&second.noun_phrase_.selrestrs) std::set(std::move(tempSelrestrs)); new(&second.noun_phrase_.synrestrs) std::set(std::move(tempSynrestrs)); break; @@ -285,7 +285,7 @@ namespace verbly { using set_type = std::set; noun_phrase_.role.~string_type(); - noun_phrase_.selrestrs.~selrestr(); + noun_phrase_.selrestrs.~set_type(); noun_phrase_.synrestrs.~set_type(); break; @@ -329,7 +329,7 @@ namespace verbly { } } - selrestr part::getNounSelrestrs() const + std::set part::getNounSelrestrs() const { if (type_ == type::noun_phrase) { -- cgit 1.4.1