From 6746da6edd7d9d50efe374eabbb79a3cac882d81 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 16 Jan 2017 18:02:50 -0500 Subject: 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. --- generator/word.h | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 generator/word.h (limited to 'generator/word.h') 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 @@ +#ifndef WORD_H_91F99D46 +#define WORD_H_91F99D46 + +#include +#include "enums.h" + +namespace verbly { + namespace generator { + + class notion; + class lemma; + class database; + class group; + + class word { + public: + + // Constructors + + word(notion& n, lemma& l); + + word(notion& n, lemma& l, int tagCount); + + // Mutators + + void setAdjectivePosition(positioning adjectivePosition); + + void setVerbGroup(const group& verbGroup); + + // Accessors + + int getId() const + { + return id_; + } + + notion& getNotion() + { + return notion_; + } + + const notion& getNotion() const + { + return notion_; + } + + lemma& getLemma() + { + return lemma_; + } + + const lemma& getLemma() const + { + return lemma_; + } + + bool hasTagCount() const + { + return hasTagCount_; + } + + int getTagCount() const + { + // Calling code should always call hasTagCount first. + assert(hasTagCount_); + + return tagCount_; + } + + positioning getAdjectivePosition() const + { + return adjectivePosition_; + } + + bool hasVerbGroup() const + { + return (verbGroup_ != nullptr); + } + + const group& getVerbGroup() const + { + // Calling code should always call hasVerbGroup first. + assert(verbGroup_ != nullptr); + + return *verbGroup_; + } + + private: + + static int nextId_; + + const int id_; + notion& notion_; + lemma& lemma_; + const int tagCount_ = 0; + const bool hasTagCount_ = false; + + positioning adjectivePosition_ = positioning::undefined; + const group* verbGroup_ = nullptr; + + }; + + // Serializer + + database& operator<<(database& db, const word& arg); + + }; +}; + +#endif /* end of include guard: WORD_H_91F99D46 */ -- cgit 1.4.1