summary refs log tree commit diff stats
path: root/generator/word.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/word.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/word.h')
-rw-r--r--generator/word.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/generator/word.h b/generator/word.h new file mode 100644 index 0000000..bfed586 --- /dev/null +++ b/generator/word.h
@@ -0,0 +1,110 @@
1#ifndef WORD_H_91F99D46
2#define WORD_H_91F99D46
3
4#include <cassert>
5#include "enums.h"
6
7namespace verbly {
8 namespace generator {
9
10 class notion;
11 class lemma;
12 class database;
13 class group;
14
15 class word {
16 public:
17
18 // Constructors
19
20 word(notion& n, lemma& l);
21
22 word(notion& n, lemma& l, int tagCount);
23
24 // Mutators
25
26 void setAdjectivePosition(positioning adjectivePosition);
27
28 void setVerbGroup(const group& verbGroup);
29
30 // Accessors
31
32 int getId() const
33 {
34 return id_;
35 }
36
37 notion& getNotion()
38 {
39 return notion_;
40 }
41
42 const notion& getNotion() const
43 {
44 return notion_;
45 }
46
47 lemma& getLemma()
48 {
49 return lemma_;
50 }
51
52 const lemma& getLemma() const
53 {
54 return lemma_;
55 }
56
57 bool hasTagCount() const
58 {
59 return hasTagCount_;
60 }
61
62 int getTagCount() const
63 {
64 // Calling code should always call hasTagCount first.
65 assert(hasTagCount_);
66
67 return tagCount_;
68 }
69
70 positioning getAdjectivePosition() const
71 {
72 return adjectivePosition_;
73 }
74
75 bool hasVerbGroup() const
76 {
77 return (verbGroup_ != nullptr);
78 }
79
80 const group& getVerbGroup() const
81 {
82 // Calling code should always call hasVerbGroup first.
83 assert(verbGroup_ != nullptr);
84
85 return *verbGroup_;
86 }
87
88 private:
89
90 static int nextId_;
91
92 const int id_;
93 notion& notion_;
94 lemma& lemma_;
95 const int tagCount_ = 0;
96 const bool hasTagCount_ = false;
97
98 positioning adjectivePosition_ = positioning::undefined;
99 const group* verbGroup_ = nullptr;
100
101 };
102
103 // Serializer
104
105 database& operator<<(database& db, const word& arg);
106
107 };
108};
109
110#endif /* end of include guard: WORD_H_91F99D46 */