summary refs log tree commit diff stats
path: root/lib/noun.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-01-16 18:02:50 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-01-16 18:02:50 -0500
commit6746da6edd7d9d50efe374eabbb79a3cac882d81 (patch)
treeff20917e08b08d36b9541c1371106596e7bec442 /lib/noun.cpp
parent4af7e55733098ca42f75a4ffaca1b0f6bab4dd36 (diff)
downloadverbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.tar.gz
verbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.tar.bz2
verbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.zip
Started structural rewrite
The new object structure was designed to build on the existing WordNet
structure, while also adding in all of the data that we get from other sources.
More information about this can be found on the project wiki.

The generator has already been completely rewritten to generate a
datafile that uses the new structure. In addition, a number of indexes
are created, which does double the size of the datafile, but also allows
for much faster lookups. Finally, the new generator is written modularly
and is a lot more readable than the old one.

The verbly interface to the new object structure has mostly been
completed, but has not been tested fully. There is a completely new
search API which utilizes a lot of operator overloading; documentation
on how to use it should go up at some point.

Token processing and verb frames are currently unimplemented. Source for
these have been left in the repository for now.
Diffstat (limited to 'lib/noun.cpp')
-rw-r--r--lib/noun.cpp221
1 files changed, 0 insertions, 221 deletions
diff --git a/lib/noun.cpp b/lib/noun.cpp deleted file mode 100644 index d8b34c9..0000000 --- a/lib/noun.cpp +++ /dev/null
@@ -1,221 +0,0 @@
1#include "verbly.h"
2#include <set>
3#include <iostream>
4
5namespace verbly {
6
7 noun::noun()
8 {
9
10 }
11
12 noun::noun(const data& _data, int _id) : word(_data, _id)
13 {
14
15 }
16
17 std::string noun::base_form() const
18 {
19 assert(_valid == true);
20
21 return _singular;
22 }
23
24 std::string noun::singular_form() const
25 {
26 assert(_valid == true);
27
28 return _singular;
29 }
30
31 std::string noun::plural_form() const
32 {
33 assert(_valid == true);
34
35 return _plural;
36 }
37
38 int noun::wnid() const
39 {
40 assert(_valid == true);
41
42 return _wnid;
43 }
44
45 bool noun::has_plural_form() const
46 {
47 assert(_valid == true);
48
49 return !_plural.empty();
50 }
51
52 noun_query noun::hypernyms() const
53 {
54 assert(_valid == true);
55
56 return _data->nouns().hypernym_of(*this);
57 }
58
59 noun_query noun::full_hypernyms() const
60 {
61 assert(_valid == true);
62
63 return _data->nouns().full_hypernym_of(*this);
64 }
65
66 noun_query noun::hyponyms() const
67 {
68 assert(_valid == true);
69
70 return _data->nouns().hyponym_of(*this);
71 }
72
73 noun_query noun::full_hyponyms() const
74 {
75 assert(_valid == true);
76
77 return _data->nouns().full_hyponym_of(*this);
78 }
79
80 noun_query noun::part_meronyms() const
81 {
82 assert(_valid == true);
83
84 return _data->nouns().part_meronym_of(*this);
85 }
86
87 noun_query noun::full_part_meronyms() const
88 {
89 assert(_valid == true);
90
91 return _data->nouns().full_part_meronym_of(*this);
92 }
93
94 noun_query noun::part_holonyms() const
95 {
96 assert(_valid == true);
97
98 return _data->nouns().part_holonym_of(*this);
99 }
100
101 noun_query noun::full_part_holonyms() const
102 {
103 assert(_valid == true);
104
105 return _data->nouns().full_part_holonym_of(*this);
106 }
107
108 noun_query noun::substance_meronyms() const
109 {
110 assert(_valid == true);
111
112 return _data->nouns().substance_meronym_of(*this);
113 }
114
115 noun_query noun::full_substance_meronyms() const
116 {
117 assert(_valid == true);
118
119 return _data->nouns().full_substance_meronym_of(*this);
120 }
121
122 noun_query noun::substance_holonyms() const
123 {
124 assert(_valid == true);
125
126 return _data->nouns().substance_holonym_of(*this);
127 }
128
129 noun_query noun::full_substance_holonyms() const
130 {
131 assert(_valid == true);
132
133 return _data->nouns().full_substance_holonym_of(*this);
134 }
135
136 noun_query noun::member_meronyms() const
137 {
138 assert(_valid == true);
139
140 return _data->nouns().member_meronym_of(*this);
141 }
142
143 noun_query noun::full_member_meronyms() const
144 {
145 assert(_valid == true);
146
147 return _data->nouns().full_member_meronym_of(*this);
148 }
149
150 noun_query noun::member_holonyms() const
151 {
152 assert(_valid == true);
153
154 return _data->nouns().member_holonym_of(*this);
155 }
156
157 noun_query noun::full_member_holonyms() const
158 {
159 assert(_valid == true);
160
161 return _data->nouns().full_member_holonym_of(*this);
162 }
163
164 noun_query noun::classes() const
165 {
166 assert(_valid == true);
167
168 return _data->nouns().class_of(*this);
169 }
170
171 noun_query noun::instances() const
172 {
173 assert(_valid == true);
174
175 return _data->nouns().instance_of(*this);
176 }
177
178 noun_query noun::synonyms() const
179 {
180 assert(_valid == true);
181
182 return _data->nouns().synonym_of(*this);
183 }
184
185 noun_query noun::antonyms() const
186 {
187 assert(_valid == true);
188
189 return _data->nouns().antonym_of(*this);
190 }
191
192 adjective_query noun::pertainyms() const
193 {
194 assert(_valid == true);
195
196 return _data->adjectives().pertainym_of(*this);
197 }
198
199 adjective_query noun::variations() const
200 {
201 assert(_valid == true);
202
203 return _data->adjectives().variant_of(*this);
204 }
205
206 std::string noun::imagenet_url() const
207 {
208 std::stringstream url;
209 url << "http://www.image-net.org/api/text/imagenet.synset.geturls?wnid=n";
210 url.width(8);
211 url.fill('0');
212 url << (_wnid % 100000000);
213 return url.str();
214 }
215
216 bool noun::operator<(const noun& other) const
217 {
218 return _id < other._id;
219 }
220
221};