diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-04-15 17:24:44 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-04-15 17:24:44 -0400 |
commit | 040ee58fecdc9c478004bc2e554e1ae126ec4602 (patch) | |
tree | 672a75690952ba8055ab9765ba0a475e056e35d4 /lib/noun.cpp | |
parent | 3a225f5eb709262b9d44d49519136ea9a2a71000 (diff) | |
download | verbly-040ee58fecdc9c478004bc2e554e1ae126ec4602.tar.gz verbly-040ee58fecdc9c478004bc2e554e1ae126ec4602.tar.bz2 verbly-040ee58fecdc9c478004bc2e554e1ae126ec4602.zip |
Added support for ImageNet and fixed bug with query interface
Datafile change: nouns now know how many images are associated with them on ImageNet, and also have their WordNet synset ID saved so that you can query for images of that noun via the ImageNet API. So far, verbly only exposes the ImageNet API URL, and doesn't actually interact with it itself. This may be changed in the future. The query interface had a huge issue in which multiple instances of the same condition would overwrite each other. This has been fixed.
Diffstat (limited to 'lib/noun.cpp')
-rw-r--r-- | lib/noun.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/noun.cpp b/lib/noun.cpp index 71c9af0..d8b34c9 100644 --- a/lib/noun.cpp +++ b/lib/noun.cpp | |||
@@ -34,6 +34,13 @@ namespace verbly { | |||
34 | 34 | ||
35 | return _plural; | 35 | return _plural; |
36 | } | 36 | } |
37 | |||
38 | int noun::wnid() const | ||
39 | { | ||
40 | assert(_valid == true); | ||
41 | |||
42 | return _wnid; | ||
43 | } | ||
37 | 44 | ||
38 | bool noun::has_plural_form() const | 45 | bool noun::has_plural_form() const |
39 | { | 46 | { |
@@ -196,6 +203,16 @@ namespace verbly { | |||
196 | return _data->adjectives().variant_of(*this); | 203 | return _data->adjectives().variant_of(*this); |
197 | } | 204 | } |
198 | 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 | |||
199 | bool noun::operator<(const noun& other) const | 216 | bool noun::operator<(const noun& other) const |
200 | { | 217 | { |
201 | return _id < other._id; | 218 | return _id < other._id; |