diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-24 23:16:07 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-24 23:16:07 -0400 |
| commit | eef5de613c75661e5d94baa086f6f2ddc26c7ed0 (patch) | |
| tree | 180230f6a245c5bca94d894273f5d2b93ded3f04 /lib/noun.h | |
| parent | d5ee4e39e5b5b3b8daa85cd972802195ad35e965 (diff) | |
| download | verbly-eef5de613c75661e5d94baa086f6f2ddc26c7ed0.tar.gz verbly-eef5de613c75661e5d94baa086f6f2ddc26c7ed0.tar.bz2 verbly-eef5de613c75661e5d94baa086f6f2ddc26c7ed0.zip | |
Added verb frames
In addition: - Added prepositions. - Rewrote a lot of the query interface. It now, for a lot of relationships, supports nested AND, OR, and NOT logic. - Rewrote the token class. It is now a union-like class instead of being polymorphic, which means smart pointers are no longer necessary. - Querying with regards to word derivation has been temporarily removed. - Sentinel values are now supported for all word types. - The VerbNet data retrieved from http://verbs.colorado.edu/~mpalmer/projects/verbnet/downloads.html was found to not be perfectly satisfactory in some regards, especially regarding adjective phrases. A patch file is now included in the repository describing the changes made to the VerbNet v3.2 download for the canonical verbly datafile.
Diffstat (limited to 'lib/noun.h')
| -rw-r--r-- | lib/noun.h | 150 |
1 files changed, 4 insertions, 146 deletions
| diff --git a/lib/noun.h b/lib/noun.h index fbc2f9e..77601d0 100644 --- a/lib/noun.h +++ b/lib/noun.h | |||
| @@ -11,6 +11,7 @@ namespace verbly { | |||
| 11 | friend class noun_query; | 11 | friend class noun_query; |
| 12 | 12 | ||
| 13 | public: | 13 | public: |
| 14 | noun(); | ||
| 14 | noun(const data& _data, int _id); | 15 | noun(const data& _data, int _id); |
| 15 | 16 | ||
| 16 | std::string base_form() const; | 17 | std::string base_form() const; |
| @@ -20,7 +21,9 @@ namespace verbly { | |||
| 20 | bool has_plural_form() const; | 21 | bool has_plural_form() const; |
| 21 | 22 | ||
| 22 | noun_query hypernyms() const; | 23 | noun_query hypernyms() const; |
| 24 | noun_query full_hypernyms() const; | ||
| 23 | noun_query hyponyms() const; | 25 | noun_query hyponyms() const; |
| 26 | noun_query full_hyponyms() const; | ||
| 24 | noun_query part_meronyms() const; | 27 | noun_query part_meronyms() const; |
| 25 | noun_query part_holonyms() const; | 28 | noun_query part_holonyms() const; |
| 26 | noun_query substance_meronyms() const; | 29 | noun_query substance_meronyms() const; |
| @@ -33,153 +36,8 @@ namespace verbly { | |||
| 33 | noun_query antonyms() const; | 36 | noun_query antonyms() const; |
| 34 | adjective_query pertainyms() const; | 37 | adjective_query pertainyms() const; |
| 35 | adjective_query variations() const; | 38 | adjective_query variations() const; |
| 36 | }; | ||
| 37 | |||
| 38 | class noun_query { | ||
| 39 | public: | ||
| 40 | noun_query(const data& _data); | ||
| 41 | |||
| 42 | noun_query& limit(int _limit); | ||
| 43 | noun_query& random(bool _random); | ||
| 44 | noun_query& except(const noun& _word); | ||
| 45 | noun_query& rhymes_with(const word& _word); | ||
| 46 | noun_query& has_pronunciation(bool _has_prn); | ||
| 47 | |||
| 48 | noun_query& is_hypernym(bool _arg); | ||
| 49 | noun_query& hypernym_of(const noun& _noun); | ||
| 50 | noun_query& not_hypernym_of(const noun& _noun); | ||
| 51 | |||
| 52 | noun_query& is_hyponym(bool _arg); | ||
| 53 | noun_query& hyponym_of(const noun& _noun); | ||
| 54 | noun_query& not_hyponym_of(const noun& _noun); | ||
| 55 | |||
| 56 | noun_query& is_part_meronym(bool _arg); | ||
| 57 | noun_query& part_meronym_of(const noun& _noun); | ||
| 58 | noun_query& not_part_meronym_of(const noun& _noun); | ||
| 59 | |||
| 60 | noun_query& is_part_holonym(bool _arg); | ||
| 61 | noun_query& part_holonym_of(const noun& _noun); | ||
| 62 | noun_query& not_part_holonym_of(const noun& _noun); | ||
| 63 | |||
| 64 | noun_query& is_substance_meronym(bool _arg); | ||
| 65 | noun_query& substance_meronym_of(const noun& _noun); | ||
| 66 | noun_query& not_substance_meronym_of(const noun& _noun); | ||
| 67 | |||
| 68 | noun_query& is_substance_holonym(bool _arg); | ||
| 69 | noun_query& substance_holonym_of(const noun& _noun); | ||
| 70 | noun_query& not_substance_holonym_of(const noun& _noun); | ||
| 71 | |||
| 72 | noun_query& is_member_meronym(bool _arg); | ||
| 73 | noun_query& member_meronym_of(const noun& _noun); | ||
| 74 | noun_query& not_member_meronym_of(const noun& _noun); | ||
| 75 | |||
| 76 | noun_query& is_member_holonym(bool _arg); | ||
| 77 | noun_query& member_holonym_of(const noun& _noun); | ||
| 78 | noun_query& not_member_holonym_of(const noun& _noun); | ||
| 79 | |||
| 80 | noun_query& is_proper(bool _arg); | ||
| 81 | noun_query& is_not_proper(bool _arg); | ||
| 82 | |||
| 83 | noun_query& is_instance(bool _arg); | ||
| 84 | noun_query& instance_of(const noun& _noun); | ||
| 85 | noun_query& not_instance_of(const noun& _noun); | ||
| 86 | |||
| 87 | noun_query& is_class(bool _arg); | ||
| 88 | noun_query& class_of(const noun& _noun); | ||
| 89 | noun_query& not_class_of(const noun& _noun); | ||
| 90 | |||
| 91 | noun_query& has_synonyms(bool _arg); | ||
| 92 | noun_query& synonym_of(const noun& _noun); | ||
| 93 | noun_query& not_synonym_of(const noun& _noun); | ||
| 94 | |||
| 95 | noun_query& has_antonyms(bool _arg); | ||
| 96 | noun_query& antonym_of(const noun& _noun); | ||
| 97 | noun_query& not_antonym_of(const noun& _noun); | ||
| 98 | |||
| 99 | noun_query& has_pertainym(bool _arg); | ||
| 100 | noun_query& anti_pertainym_of(const adjective& _adj); | ||
| 101 | |||
| 102 | noun_query& is_attribute(bool _arg); | ||
| 103 | noun_query& attribute_of(const adjective& _adj); | ||
| 104 | |||
| 105 | noun_query& derived_from(const word& _w); | ||
| 106 | noun_query& not_derived_from(const word& _w); | ||
| 107 | |||
| 108 | std::list<noun> run() const; | ||
| 109 | |||
| 110 | const static int unlimited = -1; | ||
| 111 | |||
| 112 | private: | ||
| 113 | const data& _data; | ||
| 114 | int _limit = unlimited; | ||
| 115 | bool _random = false; | ||
| 116 | std::list<std::string> _rhymes; | ||
| 117 | std::list<noun> _except; | ||
| 118 | bool _has_prn = false; | ||
| 119 | |||
| 120 | bool _is_hypernym = false; | ||
| 121 | std::list<noun> _hypernym_of; | ||
| 122 | std::list<noun> _not_hypernym_of; | ||
| 123 | |||
| 124 | bool _is_hyponym = false; | ||
| 125 | std::list<noun> _hyponym_of; | ||
| 126 | std::list<noun> _not_hyponym_of; | ||
| 127 | |||
| 128 | bool _is_part_meronym = false; | ||
| 129 | std::list<noun> _part_meronym_of; | ||
| 130 | std::list<noun> _not_part_meronym_of; | ||
| 131 | |||
| 132 | bool _is_substance_meronym = false; | ||
| 133 | std::list<noun> _substance_meronym_of; | ||
| 134 | std::list<noun> _not_substance_meronym_of; | ||
| 135 | |||
| 136 | bool _is_member_meronym = false; | ||
| 137 | std::list<noun> _member_meronym_of; | ||
| 138 | std::list<noun> _not_member_meronym_of; | ||
| 139 | |||
| 140 | bool _is_part_holonym = false; | ||
| 141 | std::list<noun> _part_holonym_of; | ||
| 142 | std::list<noun> _not_part_holonym_of; | ||
| 143 | |||
| 144 | bool _is_substance_holonym = false; | ||
| 145 | std::list<noun> _substance_holonym_of; | ||
| 146 | std::list<noun> _not_substance_holonym_of; | ||
| 147 | |||
| 148 | bool _is_member_holonym = false; | ||
| 149 | std::list<noun> _member_holonym_of; | ||
| 150 | std::list<noun> _not_member_holonym_of; | ||
| 151 | |||
| 152 | bool _is_proper = false; | ||
| 153 | bool _is_not_proper = false; | ||
| 154 | |||
| 155 | bool _is_instance = false; | ||
| 156 | std::list<noun> _instance_of; | ||
| 157 | std::list<noun> _not_instance_of; | ||
| 158 | |||
| 159 | bool _is_class = false; | ||
| 160 | std::list<noun> _class_of; | ||
| 161 | std::list<noun> _not_class_of; | ||
| 162 | |||
| 163 | bool _has_synonyms = false; | ||
| 164 | std::list<noun> _synonym_of; | ||
| 165 | std::list<noun> _not_synonym_of; | ||
| 166 | |||
| 167 | bool _has_antonyms = false; | ||
| 168 | std::list<noun> _antonym_of; | ||
| 169 | std::list<noun> _not_antonym_of; | ||
| 170 | |||
| 171 | bool _has_pertainym = false; | ||
| 172 | std::list<adjective> _anti_pertainym_of; | ||
| 173 | |||
| 174 | bool _is_attribute = false; | ||
| 175 | std::list<adjective> _attribute_of; | ||
| 176 | 39 | ||
| 177 | std::list<adjective> _derived_from_adjective; | 40 | bool operator<(const noun& other) const; |
| 178 | std::list<adjective> _not_derived_from_adjective; | ||
| 179 | std::list<adverb> _derived_from_adverb; | ||
| 180 | std::list<adverb> _not_derived_from_adverb; | ||
| 181 | std::list<noun> _derived_from_noun; | ||
| 182 | std::list<noun> _not_derived_from_noun; | ||
| 183 | }; | 41 | }; |
| 184 | 42 | ||
| 185 | }; | 43 | }; |
