From 02c187fd3141203024b6f359ec714c0b804583c0 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 19 Mar 2016 14:40:21 -0400 Subject: Nouns with any uppercase letters are now considered proper --- lib/noun.cpp | 16 ++++++++++++++-- lib/noun.h | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/noun.cpp b/lib/noun.cpp index 43fda2e..81e6613 100644 --- a/lib/noun.cpp +++ b/lib/noun.cpp @@ -330,6 +330,13 @@ namespace verbly { return *this; } + noun_query& noun_query::is_instance(bool _arg) + { + _is_instance = _arg; + + return *this; + } + noun_query& noun_query::instance_of(const noun& _noun) { _instance_of.push_back(_noun); @@ -644,12 +651,17 @@ namespace verbly { if (_is_proper) { - conditions.push_back("noun_id IN (SELECT instance_id FROM instantiation)"); + conditions.push_back("proper = 1"); } if (_is_not_proper) { - conditions.push_back("noun_id NOT IN (SELECT instance_id FROM instantiation)"); + conditions.push_back("proper = 0"); + } + + if (_is_instance) + { + conditions.push_back("noun_id IN (SELECT instance_id FROM instantiation)"); } if (!_instance_of.empty()) diff --git a/lib/noun.h b/lib/noun.h index da76866..fbc2f9e 100644 --- a/lib/noun.h +++ b/lib/noun.h @@ -79,6 +79,8 @@ namespace verbly { noun_query& is_proper(bool _arg); noun_query& is_not_proper(bool _arg); + + noun_query& is_instance(bool _arg); noun_query& instance_of(const noun& _noun); noun_query& not_instance_of(const noun& _noun); @@ -149,6 +151,8 @@ namespace verbly { bool _is_proper = false; bool _is_not_proper = false; + + bool _is_instance = false; std::list _instance_of; std::list _not_instance_of; -- cgit 1.4.1