summary refs log tree commit diff stats
path: root/generator/notion.h
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 /generator/notion.h
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 'generator/notion.h')
-rw-r--r--generator/notion.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/generator/notion.h b/generator/notion.h new file mode 100644 index 0000000..76210de --- /dev/null +++ b/generator/notion.h
@@ -0,0 +1,91 @@
1#ifndef NOTION_H_221DE2BC
2#define NOTION_H_221DE2BC
3
4#include <cassert>
5#include <list>
6#include <string>
7#include "enums.h"
8
9namespace verbly {
10 namespace generator {
11
12 class database;
13
14 class notion {
15 public:
16
17 // Constructors
18
19 explicit notion(part_of_speech partOfSpeech);
20
21 notion(part_of_speech partOfSpeech, int wnid);
22
23 // Mutators
24
25 void incrementNumOfImages();
26
27 void setPrepositionGroups(std::list<std::string> groups);
28
29 // Accessors
30
31 int getId() const
32 {
33 return id_;
34 }
35
36 part_of_speech getPartOfSpeech() const
37 {
38 return partOfSpeech_;
39 }
40
41 bool hasWnid() const
42 {
43 return hasWnid_;
44 }
45
46 int getWnid() const
47 {
48 // Calling code should always call hasWnid first.
49 assert(hasWnid_);
50
51 return wnid_;
52 }
53
54 int getNumOfImages() const
55 {
56 // Calling code should always call hasWnid and check that the notion is a noun first.
57 assert(hasWnid_ && (partOfSpeech_ == part_of_speech::noun));
58
59 return numOfImages_;
60 }
61
62 std::list<std::string> getPrepositionGroups() const
63 {
64 // Calling code should always check that the notion is a preposition first.
65 assert(partOfSpeech_ == part_of_speech::preposition);
66
67 return prepositionGroups_;
68 }
69
70 private:
71
72 static int nextId_;
73
74 const int id_;
75 const part_of_speech partOfSpeech_;
76 const int wnid_ = 0;
77 const bool hasWnid_ = false;
78
79 int numOfImages_ = 0;
80 std::list<std::string> prepositionGroups_;
81
82 };
83
84 // Serializer
85
86 database& operator<<(database& db, const notion& arg);
87
88 };
89};
90
91#endif /* end of include guard: NOTION_H_221DE2BC */