summary refs log tree commit diff stats
path: root/generator
diff options
context:
space:
mode:
Diffstat (limited to 'generator')
-rw-r--r--generator/database.cpp14
-rw-r--r--generator/database.h2
-rw-r--r--generator/field.h12
-rw-r--r--generator/frame.h38
-rw-r--r--generator/generator.h108
-rw-r--r--generator/group.cpp46
-rw-r--r--generator/group.h52
-rw-r--r--generator/main.cpp2
-rw-r--r--generator/notion.cpp14
-rw-r--r--generator/notion.h8
-rw-r--r--generator/part.cpp134
-rw-r--r--generator/part.h74
-rw-r--r--generator/progress.h16
-rw-r--r--generator/word.cpp8
-rw-r--r--generator/word.h10
15 files changed, 269 insertions, 269 deletions
diff --git a/generator/database.cpp b/generator/database.cpp index c7e4cfa..188fa2a 100644 --- a/generator/database.cpp +++ b/generator/database.cpp
@@ -73,19 +73,19 @@ namespace verbly {
73 { 73 {
74 sqlite3_close_v2(ppdb_); 74 sqlite3_close_v2(ppdb_);
75 } 75 }
76 76
77 void database::runQuery(std::string query) 77 void database::runQuery(std::string query)
78 { 78 {
79 // This can only happen when doing bad things with move semantics. 79 // This can only happen when doing bad things with move semantics.
80 assert(ppdb_ != nullptr); 80 assert(ppdb_ != nullptr);
81 81
82 sqlite3_stmt* ppstmt; 82 sqlite3_stmt* ppstmt;
83 83
84 if (sqlite3_prepare_v2(ppdb_, query.c_str(), query.length(), &ppstmt, NULL) != SQLITE_OK) 84 if (sqlite3_prepare_v2(ppdb_, query.c_str(), query.length(), &ppstmt, NULL) != SQLITE_OK)
85 { 85 {
86 throw sqlite3_error("Error writing to database", sqlite3_errmsg(ppdb_)); 86 throw sqlite3_error("Error writing to database", sqlite3_errmsg(ppdb_));
87 } 87 }
88 88
89 int result = sqlite3_step(ppstmt); 89 int result = sqlite3_step(ppstmt);
90 sqlite3_finalize(ppstmt); 90 sqlite3_finalize(ppstmt);
91 91
@@ -99,10 +99,10 @@ namespace verbly {
99 { 99 {
100 // This can only happen when doing bad things with move semantics. 100 // This can only happen when doing bad things with move semantics.
101 assert(ppdb_ != nullptr); 101 assert(ppdb_ != nullptr);
102 102
103 // This shouldn't happen. 103 // This shouldn't happen.
104 assert(!fields.empty()); 104 assert(!fields.empty());
105 105
106 std::list<std::string> fieldNames; 106 std::list<std::string> fieldNames;
107 std::list<std::string> qs; 107 std::list<std::string> qs;
108 for (field& f : fields) 108 for (field& f : fields)
@@ -110,7 +110,7 @@ namespace verbly {
110 fieldNames.push_back(f.getName()); 110 fieldNames.push_back(f.getName());
111 qs.push_back("?"); 111 qs.push_back("?");
112 } 112 }
113 113
114 std::ostringstream query; 114 std::ostringstream query;
115 query << "INSERT INTO "; 115 query << "INSERT INTO ";
116 query << table; 116 query << table;
@@ -119,7 +119,7 @@ namespace verbly {
119 query << ") VALUES ("; 119 query << ") VALUES (";
120 query << implode(std::begin(qs), std::end(qs), ", "); 120 query << implode(std::begin(qs), std::end(qs), ", ");
121 query << ")"; 121 query << ")";
122 122
123 std::string query_str = query.str(); 123 std::string query_str = query.str();
124 124
125 sqlite3_stmt* ppstmt; 125 sqlite3_stmt* ppstmt;
diff --git a/generator/database.h b/generator/database.h index 15cdff5..7906304 100644 --- a/generator/database.h +++ b/generator/database.h
@@ -52,7 +52,7 @@ namespace verbly {
52 ~database(); 52 ~database();
53 53
54 // Actions 54 // Actions
55 55
56 void runQuery(std::string query); 56 void runQuery(std::string query);
57 57
58 void insertIntoTable(std::string table, std::list<field> fields); 58 void insertIntoTable(std::string table, std::list<field> fields);
diff --git a/generator/field.h b/generator/field.h index 1fbabfc..aaca3fa 100644 --- a/generator/field.h +++ b/generator/field.h
@@ -32,27 +32,27 @@ namespace verbly {
32 ~field(); 32 ~field();
33 33
34 // Generic accessors 34 // Generic accessors
35 35
36 type getType() const 36 type getType() const
37 { 37 {
38 return type_; 38 return type_;
39 } 39 }
40 40
41 std::string getName() const 41 std::string getName() const
42 { 42 {
43 return name_; 43 return name_;
44 } 44 }
45 45
46 // Integer 46 // Integer
47 47
48 field(std::string name, int arg); 48 field(std::string name, int arg);
49 49
50 int getInteger() const; 50 int getInteger() const;
51 51
52 // String 52 // String
53 53
54 field(std::string name, std::string arg); 54 field(std::string name, std::string arg);
55 55
56 std::string getString() const; 56 std::string getString() const;
57 57
58 private: 58 private:
diff --git a/generator/frame.h b/generator/frame.h index 411ce6c..764564d 100644 --- a/generator/frame.h +++ b/generator/frame.h
@@ -6,53 +6,53 @@
6 6
7namespace verbly { 7namespace verbly {
8 namespace generator { 8 namespace generator {
9 9
10 class database; 10 class database;
11 11
12 class frame { 12 class frame {
13 public: 13 public:
14 14
15 // Aliases 15 // Aliases
16 16
17 using const_iterator = std::list<part>::const_iterator; 17 using const_iterator = std::list<part>::const_iterator;
18 18
19 // Constructor 19 // Constructor
20 20
21 frame(); 21 frame();
22 22
23 // Mutators 23 // Mutators
24 24
25 void push_back(part fp); 25 void push_back(part fp);
26 26
27 // Accessors 27 // Accessors
28 28
29 int getId() const 29 int getId() const
30 { 30 {
31 return id_; 31 return id_;
32 } 32 }
33 33
34 const_iterator begin() const 34 const_iterator begin() const
35 { 35 {
36 return std::begin(parts_); 36 return std::begin(parts_);
37 } 37 }
38 38
39 const_iterator end() const 39 const_iterator end() const
40 { 40 {
41 return std::end(parts_); 41 return std::end(parts_);
42 } 42 }
43 43
44 private: 44 private:
45 45
46 static int nextId_; 46 static int nextId_;
47 47
48 const int id_; 48 const int id_;
49 49
50 std::list<part> parts_; 50 std::list<part> parts_;
51 51
52 }; 52 };
53 53
54 database& operator<<(database& db, const frame& arg); 54 database& operator<<(database& db, const frame& arg);
55 55
56 }; 56 };
57}; 57};
58 58
diff --git a/generator/generator.h b/generator/generator.h index c829c21..8352693 100644 --- a/generator/generator.h +++ b/generator/generator.h
@@ -16,17 +16,17 @@
16#include "frame.h" 16#include "frame.h"
17 17
18namespace verbly { 18namespace verbly {
19 19
20 enum class part_of_speech; 20 enum class part_of_speech;
21 class selrestr; 21 class selrestr;
22 22
23 namespace generator { 23 namespace generator {
24 24
25 class generator { 25 class generator {
26 public: 26 public:
27 27
28 // Constructor 28 // Constructor
29 29
30 generator( 30 generator(
31 std::string verbNetPath, 31 std::string verbNetPath,
32 std::string agidPath, 32 std::string agidPath,
@@ -34,95 +34,95 @@ namespace verbly {
34 std::string cmudictPath, 34 std::string cmudictPath,
35 std::string imageNetPath, 35 std::string imageNetPath,
36 std::string outputPath); 36 std::string outputPath);
37 37
38 // Action 38 // Action
39 39
40 void run(); 40 void run();
41 41
42 private: 42 private:
43 43
44 // Subroutines 44 // Subroutines
45 45
46 void readWordNetSynsets(); 46 void readWordNetSynsets();
47 47
48 void readAdjectivePositioning(); 48 void readAdjectivePositioning();
49 49
50 void readImageNetUrls(); 50 void readImageNetUrls();
51 51
52 void readWordNetSenseKeys(); 52 void readWordNetSenseKeys();
53 53
54 void readVerbNet(); 54 void readVerbNet();
55 55
56 void readAgidInflections(); 56 void readAgidInflections();
57 57
58 void readPrepositions(); 58 void readPrepositions();
59 59
60 void readCmudictPronunciations(); 60 void readCmudictPronunciations();
61 61
62 void writeSchema(); 62 void writeSchema();
63 63
64 void dumpObjects(); 64 void dumpObjects();
65 65
66 void readWordNetAntonymy(); 66 void readWordNetAntonymy();
67 67
68 void readWordNetVariation(); 68 void readWordNetVariation();
69 69
70 void readWordNetClasses(); 70 void readWordNetClasses();
71 71
72 void readWordNetCausality(); 72 void readWordNetCausality();
73 73
74 void readWordNetEntailment(); 74 void readWordNetEntailment();
75 75
76 void readWordNetHypernymy(); 76 void readWordNetHypernymy();
77 77
78 void readWordNetInstantiation(); 78 void readWordNetInstantiation();
79 79
80 void readWordNetMemberMeronymy(); 80 void readWordNetMemberMeronymy();
81 81
82 void readWordNetPartMeronymy(); 82 void readWordNetPartMeronymy();
83 83
84 void readWordNetSubstanceMeronymy(); 84 void readWordNetSubstanceMeronymy();
85 85
86 void readWordNetPertainymy(); 86 void readWordNetPertainymy();
87 87
88 void readWordNetSpecification(); 88 void readWordNetSpecification();
89 89
90 void readWordNetSimilarity(); 90 void readWordNetSimilarity();
91 91
92 // Helpers 92 // Helpers
93 93
94 std::list<std::string> readFile(std::string path); 94 std::list<std::string> readFile(std::string path);
95 95
96 inline part_of_speech partOfSpeechByWnid(int wnid); 96 inline part_of_speech partOfSpeechByWnid(int wnid);
97 97
98 notion& createNotion(part_of_speech partOfSpeech); 98 notion& createNotion(part_of_speech partOfSpeech);
99 99
100 notion& lookupOrCreateNotion(int wnid); 100 notion& lookupOrCreateNotion(int wnid);
101 101
102 lemma& lookupOrCreateLemma(std::string base_form); 102 lemma& lookupOrCreateLemma(std::string base_form);
103 103
104 form& lookupOrCreateForm(std::string text); 104 form& lookupOrCreateForm(std::string text);
105 105
106 template <typename... Args> word& createWord(Args&&... args); 106 template <typename... Args> word& createWord(Args&&... args);
107 107
108 group& createGroup(xmlNodePtr top); 108 group& createGroup(xmlNodePtr top);
109 109
110 selrestr parseSelrestr(xmlNodePtr top); 110 selrestr parseSelrestr(xmlNodePtr top);
111 111
112 // Input 112 // Input
113 113
114 std::string verbNetPath_; 114 std::string verbNetPath_;
115 std::string agidPath_; 115 std::string agidPath_;
116 std::string wordNetPath_; 116 std::string wordNetPath_;
117 std::string cmudictPath_; 117 std::string cmudictPath_;
118 std::string imageNetPath_; 118 std::string imageNetPath_;
119 119
120 // Output 120 // Output
121 121
122 database db_; 122 database db_;
123 123
124 // Data 124 // Data
125 125
126 std::list<notion> notions_; 126 std::list<notion> notions_;
127 std::list<word> words_; 127 std::list<word> words_;
128 std::list<lemma> lemmas_; 128 std::list<lemma> lemmas_;
@@ -130,22 +130,22 @@ namespace verbly {
130 std::list<pronunciation> pronunciations_; 130 std::list<pronunciation> pronunciations_;
131 std::list<frame> frames_; 131 std::list<frame> frames_;
132 std::list<group> groups_; 132 std::list<group> groups_;
133 133
134 // Indexes 134 // Indexes
135 135
136 std::map<int, notion*> notionByWnid_; 136 std::map<int, notion*> notionByWnid_;
137 std::map<int, std::set<word*>> wordsByWnid_; 137 std::map<int, std::set<word*>> wordsByWnid_;
138 std::map<std::pair<int, int>, word*> wordByWnidAndWnum_; 138 std::map<std::pair<int, int>, word*> wordByWnidAndWnum_;
139 std::map<std::string, std::set<word*>> wordsByBaseForm_; 139 std::map<std::string, std::set<word*>> wordsByBaseForm_;
140 std::map<std::string, lemma*> lemmaByBaseForm_; 140 std::map<std::string, lemma*> lemmaByBaseForm_;
141 std::map<std::string, form*> formByText_; 141 std::map<std::string, form*> formByText_;
142 142
143 // Caches 143 // Caches
144 144
145 std::map<std::string, word*> wnSenseKeys_; 145 std::map<std::string, word*> wnSenseKeys_;
146 146
147 }; 147 };
148 148
149 }; 149 };
150}; 150};
151 151
diff --git a/generator/group.cpp b/generator/group.cpp index 334c2aa..cebe2b9 100644 --- a/generator/group.cpp +++ b/generator/group.cpp
@@ -8,37 +8,37 @@
8 8
9namespace verbly { 9namespace verbly {
10 namespace generator { 10 namespace generator {
11 11
12 int group::nextId_ = 0; 12 int group::nextId_ = 0;
13 13
14 group::group() : id_(nextId_++) 14 group::group() : id_(nextId_++)
15 { 15 {
16 } 16 }
17 17
18 void group::setParent(const group& parent) 18 void group::setParent(const group& parent)
19 { 19 {
20 // Adding a group to itself is nonsensical. 20 // Adding a group to itself is nonsensical.
21 assert(&parent != this); 21 assert(&parent != this);
22 22
23 parent_ = &parent; 23 parent_ = &parent;
24 } 24 }
25 25
26 void group::addRole(role r) 26 void group::addRole(role r)
27 { 27 {
28 std::string name = r.getName(); 28 std::string name = r.getName();
29 roles_[name] = std::move(r); 29 roles_[name] = std::move(r);
30 roleNames_.insert(std::move(name)); 30 roleNames_.insert(std::move(name));
31 } 31 }
32 32
33 void group::addFrame(const frame& f) 33 void group::addFrame(const frame& f)
34 { 34 {
35 frames_.insert(&f); 35 frames_.insert(&f);
36 } 36 }
37 37
38 std::set<std::string> group::getRoles() const 38 std::set<std::string> group::getRoles() const
39 { 39 {
40 std::set<std::string> fullRoles = roleNames_; 40 std::set<std::string> fullRoles = roleNames_;
41 41
42 if (hasParent()) 42 if (hasParent())
43 { 43 {
44 for (std::string name : getParent().getRoles()) 44 for (std::string name : getParent().getRoles())
@@ -46,10 +46,10 @@ namespace verbly {
46 fullRoles.insert(name); 46 fullRoles.insert(name);
47 } 47 }
48 } 48 }
49 49
50 return fullRoles; 50 return fullRoles;
51 } 51 }
52 52
53 const role& group::getRole(std::string name) const 53 const role& group::getRole(std::string name) const
54 { 54 {
55 if (roles_.count(name)) 55 if (roles_.count(name))
@@ -62,11 +62,11 @@ namespace verbly {
62 throw std::invalid_argument("Specified role not found in verb group"); 62 throw std::invalid_argument("Specified role not found in verb group");
63 } 63 }
64 } 64 }
65 65
66 std::set<const frame*> group::getFrames() const 66 std::set<const frame*> group::getFrames() const
67 { 67 {
68 std::set<const frame*> fullFrames = frames_; 68 std::set<const frame*> fullFrames = frames_;
69 69
70 if (hasParent()) 70 if (hasParent())
71 { 71 {
72 for (const frame* f : getParent().getFrames()) 72 for (const frame* f : getParent().getFrames())
@@ -74,47 +74,47 @@ namespace verbly {
74 fullFrames.insert(f); 74 fullFrames.insert(f);
75 } 75 }
76 } 76 }
77 77
78 return fullFrames; 78 return fullFrames;
79 } 79 }
80 80
81 database& operator<<(database& db, const group& arg) 81 database& operator<<(database& db, const group& arg)
82 { 82 {
83 // Serialize the group first 83 // Serialize the group first
84 { 84 {
85 std::list<field> fields; 85 std::list<field> fields;
86 fields.emplace_back("group_id", arg.getId()); 86 fields.emplace_back("group_id", arg.getId());
87 87
88 nlohmann::json jsonRoles; 88 nlohmann::json jsonRoles;
89 for (std::string name : arg.getRoles()) 89 for (std::string name : arg.getRoles())
90 { 90 {
91 const role& r = arg.getRole(name); 91 const role& r = arg.getRole(name);
92 92
93 nlohmann::json jsonRole; 93 nlohmann::json jsonRole;
94 jsonRole["type"] = name; 94 jsonRole["type"] = name;
95 jsonRole["selrestrs"] = r.getSelrestrs().toJson(); 95 jsonRole["selrestrs"] = r.getSelrestrs().toJson();
96 96
97 jsonRoles.emplace_back(std::move(jsonRole)); 97 jsonRoles.emplace_back(std::move(jsonRole));
98 } 98 }
99 99
100 fields.emplace_back("data", jsonRoles.dump()); 100 fields.emplace_back("data", jsonRoles.dump());
101 101
102 db.insertIntoTable("groups", std::move(fields)); 102 db.insertIntoTable("groups", std::move(fields));
103 } 103 }
104 104
105 // Then, serialize the group/frame relationship 105 // Then, serialize the group/frame relationship
106 for (const frame* f : arg.getFrames()) 106 for (const frame* f : arg.getFrames())
107 { 107 {
108 std::list<field> fields; 108 std::list<field> fields;
109 109
110 fields.emplace_back("group_id", arg.getId()); 110 fields.emplace_back("group_id", arg.getId());
111 fields.emplace_back("frame_id", f->getId()); 111 fields.emplace_back("frame_id", f->getId());
112 112
113 db.insertIntoTable("groups_frames", std::move(fields)); 113 db.insertIntoTable("groups_frames", std::move(fields));
114 } 114 }
115 115
116 return db; 116 return db;
117 } 117 }
118 118
119 }; 119 };
120}; 120};
diff --git a/generator/group.h b/generator/group.h index 5084ea4..83f40c2 100644 --- a/generator/group.h +++ b/generator/group.h
@@ -9,71 +9,71 @@
9 9
10namespace verbly { 10namespace verbly {
11 namespace generator { 11 namespace generator {
12 12
13 class frame; 13 class frame;
14 class database; 14 class database;
15 15
16 class group { 16 class group {
17 public: 17 public:
18 18
19 // Constructor 19 // Constructor
20 20
21 group(); 21 group();
22 22
23 // Mutators 23 // Mutators
24 24
25 void setParent(const group& parent); 25 void setParent(const group& parent);
26 26
27 void addRole(role r); 27 void addRole(role r);
28 28
29 void addFrame(const frame& f); 29 void addFrame(const frame& f);
30 30
31 // Accessors 31 // Accessors
32 32
33 int getId() const 33 int getId() const
34 { 34 {
35 return id_; 35 return id_;
36 } 36 }
37 37
38 bool hasParent() const 38 bool hasParent() const
39 { 39 {
40 return (parent_ != nullptr); 40 return (parent_ != nullptr);
41 } 41 }
42 42
43 const group& getParent() const 43 const group& getParent() const
44 { 44 {
45 // Calling code should always call hasParent first 45 // Calling code should always call hasParent first
46 assert(parent_ != nullptr); 46 assert(parent_ != nullptr);
47 47
48 return *parent_; 48 return *parent_;
49 } 49 }
50 50
51 std::set<std::string> getRoles() const; 51 std::set<std::string> getRoles() const;
52 52
53 const role& getRole(std::string name) const; 53 const role& getRole(std::string name) const;
54 54
55 std::set<const frame*> getFrames() const; 55 std::set<const frame*> getFrames() const;
56 56
57 private: 57 private:
58 58
59 static int nextId_; 59 static int nextId_;
60 60
61 const int id_; 61 const int id_;
62 62
63 const group* parent_ = nullptr; 63 const group* parent_ = nullptr;
64 std::map<std::string, role> roles_; 64 std::map<std::string, role> roles_;
65 std::set<const frame*> frames_; 65 std::set<const frame*> frames_;
66 66
67 // Caches 67 // Caches
68 68
69 std::set<std::string> roleNames_; 69 std::set<std::string> roleNames_;
70 70
71 }; 71 };
72 72
73 // Serializer 73 // Serializer
74 74
75 database& operator<<(database& db, const group& arg); 75 database& operator<<(database& db, const group& arg);
76 76
77 }; 77 };
78}; 78};
79 79
diff --git a/generator/main.cpp b/generator/main.cpp index 827c963..1b07706 100644 --- a/generator/main.cpp +++ b/generator/main.cpp
@@ -20,7 +20,7 @@ int main(int argc, char** argv)
20 try 20 try
21 { 21 {
22 verbly::generator::generator app(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); 22 verbly::generator::generator app(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
23 23
24 try 24 try
25 { 25 {
26 app.run(); 26 app.run();
diff --git a/generator/notion.cpp b/generator/notion.cpp index 290d982..1878ba9 100644 --- a/generator/notion.cpp +++ b/generator/notion.cpp
@@ -30,15 +30,15 @@ namespace verbly {
30 { 30 {
31 // Calling code should always call hasWnid and check that the notion is a noun first. 31 // Calling code should always call hasWnid and check that the notion is a noun first.
32 assert(hasWnid_ && (partOfSpeech_ == part_of_speech::noun)); 32 assert(hasWnid_ && (partOfSpeech_ == part_of_speech::noun));
33 33
34 numOfImages_++; 34 numOfImages_++;
35 } 35 }
36 36
37 void notion::setPrepositionGroups(std::list<std::string> groups) 37 void notion::setPrepositionGroups(std::list<std::string> groups)
38 { 38 {
39 // Calling code should always check that the notion is a preposition first. 39 // Calling code should always check that the notion is a preposition first.
40 assert(partOfSpeech_ == part_of_speech::preposition); 40 assert(partOfSpeech_ == part_of_speech::preposition);
41 41
42 prepositionGroups_ = groups; 42 prepositionGroups_ = groups;
43 } 43 }
44 44
@@ -54,7 +54,7 @@ namespace verbly {
54 if (arg.hasWnid()) 54 if (arg.hasWnid())
55 { 55 {
56 fields.emplace_back("wnid", arg.getWnid()); 56 fields.emplace_back("wnid", arg.getWnid());
57 57
58 if (arg.getPartOfSpeech() == part_of_speech::noun) 58 if (arg.getPartOfSpeech() == part_of_speech::noun)
59 { 59 {
60 fields.emplace_back("images", arg.getNumOfImages()); 60 fields.emplace_back("images", arg.getNumOfImages());
@@ -63,17 +63,17 @@ namespace verbly {
63 63
64 db.insertIntoTable("notions", std::move(fields)); 64 db.insertIntoTable("notions", std::move(fields));
65 } 65 }
66 66
67 // Next, serialize the is_a relationship if this is a preposition 67 // Next, serialize the is_a relationship if this is a preposition
68 if (arg.getPartOfSpeech() == part_of_speech::preposition) 68 if (arg.getPartOfSpeech() == part_of_speech::preposition)
69 { 69 {
70 for (std::string group : arg.getPrepositionGroups()) 70 for (std::string group : arg.getPrepositionGroups())
71 { 71 {
72 std::list<field> fields; 72 std::list<field> fields;
73 73
74 fields.emplace_back("notion_id", arg.getId()); 74 fields.emplace_back("notion_id", arg.getId());
75 fields.emplace_back("groupname", group); 75 fields.emplace_back("groupname", group);
76 76
77 db.insertIntoTable("is_a", std::move(fields)); 77 db.insertIntoTable("is_a", std::move(fields));
78 } 78 }
79 } 79 }
diff --git a/generator/notion.h b/generator/notion.h index cc64c48..6e38497 100644 --- a/generator/notion.h +++ b/generator/notion.h
@@ -23,7 +23,7 @@ namespace verbly {
23 // Mutators 23 // Mutators
24 24
25 void incrementNumOfImages(); 25 void incrementNumOfImages();
26 26
27 void setPrepositionGroups(std::list<std::string> groups); 27 void setPrepositionGroups(std::list<std::string> groups);
28 28
29 // Accessors 29 // Accessors
@@ -37,7 +37,7 @@ namespace verbly {
37 { 37 {
38 return partOfSpeech_; 38 return partOfSpeech_;
39 } 39 }
40 40
41 bool hasWnid() const 41 bool hasWnid() const
42 { 42 {
43 return hasWnid_; 43 return hasWnid_;
@@ -58,12 +58,12 @@ namespace verbly {
58 58
59 return numOfImages_; 59 return numOfImages_;
60 } 60 }
61 61
62 std::list<std::string> getPrepositionGroups() const 62 std::list<std::string> getPrepositionGroups() const
63 { 63 {
64 // Calling code should always check that the notion is a preposition first. 64 // Calling code should always check that the notion is a preposition first.
65 assert(partOfSpeech_ == part_of_speech::preposition); 65 assert(partOfSpeech_ == part_of_speech::preposition);
66 66
67 return prepositionGroups_; 67 return prepositionGroups_;
68 } 68 }
69 69
diff --git a/generator/part.cpp b/generator/part.cpp index b69ec65..8a75ed4 100644 --- a/generator/part.cpp +++ b/generator/part.cpp
@@ -3,56 +3,56 @@
3 3
4namespace verbly { 4namespace verbly {
5 namespace generator { 5 namespace generator {
6 6
7 part part::createNounPhrase(std::string role, selrestr selrestrs, std::set<std::string> synrestrs) 7 part part::createNounPhrase(std::string role, selrestr selrestrs, std::set<std::string> synrestrs)
8 { 8 {
9 part p(type::noun_phrase); 9 part p(type::noun_phrase);
10 10
11 new(&p.noun_phrase_.role) std::string(std::move(role)); 11 new(&p.noun_phrase_.role) std::string(std::move(role));
12 new(&p.noun_phrase_.selrestrs) selrestr(std::move(selrestrs)); 12 new(&p.noun_phrase_.selrestrs) selrestr(std::move(selrestrs));
13 new(&p.noun_phrase_.synrestrs) std::set<std::string>(std::move(synrestrs)); 13 new(&p.noun_phrase_.synrestrs) std::set<std::string>(std::move(synrestrs));
14 14
15 return p; 15 return p;
16 } 16 }
17 17
18 part part::createVerb() 18 part part::createVerb()
19 { 19 {
20 return part(type::verb); 20 return part(type::verb);
21 } 21 }
22 22
23 part part::createPreposition(std::set<std::string> choices, bool literal) 23 part part::createPreposition(std::set<std::string> choices, bool literal)
24 { 24 {
25 part p(type::preposition); 25 part p(type::preposition);
26 26
27 new(&p.preposition_.choices) std::set<std::string>(std::move(choices)); 27 new(&p.preposition_.choices) std::set<std::string>(std::move(choices));
28 p.preposition_.literal = literal; 28 p.preposition_.literal = literal;
29 29
30 return p; 30 return p;
31 } 31 }
32 32
33 part part::createAdjective() 33 part part::createAdjective()
34 { 34 {
35 return part(type::adjective); 35 return part(type::adjective);
36 } 36 }
37 37
38 part part::createAdverb() 38 part part::createAdverb()
39 { 39 {
40 return part(type::adverb); 40 return part(type::adverb);
41 } 41 }
42 42
43 part part::createLiteral(std::string value) 43 part part::createLiteral(std::string value)
44 { 44 {
45 part p(type::literal); 45 part p(type::literal);
46 46
47 new(&p.literal_) std::string(std::move(value)); 47 new(&p.literal_) std::string(std::move(value));
48 48
49 return p; 49 return p;
50 } 50 }
51 51
52 part::part(const part& other) 52 part::part(const part& other)
53 { 53 {
54 type_ = other.type_; 54 type_ = other.type_;
55 55
56 switch (type_) 56 switch (type_)
57 { 57 {
58 case type::noun_phrase: 58 case type::noun_phrase:
@@ -60,25 +60,25 @@ namespace verbly {
60 new(&noun_phrase_.role) std::string(other.noun_phrase_.role); 60 new(&noun_phrase_.role) std::string(other.noun_phrase_.role);
61 new(&noun_phrase_.selrestrs) selrestr(other.noun_phrase_.selrestrs); 61 new(&noun_phrase_.selrestrs) selrestr(other.noun_phrase_.selrestrs);
62 new(&noun_phrase_.synrestrs) std::set<std::string>(other.noun_phrase_.synrestrs); 62 new(&noun_phrase_.synrestrs) std::set<std::string>(other.noun_phrase_.synrestrs);
63 63
64 break; 64 break;
65 } 65 }
66 66
67 case type::preposition: 67 case type::preposition:
68 { 68 {
69 new(&preposition_.choices) std::set<std::string>(other.preposition_.choices); 69 new(&preposition_.choices) std::set<std::string>(other.preposition_.choices);
70 preposition_.literal = other.preposition_.literal; 70 preposition_.literal = other.preposition_.literal;
71 71
72 break; 72 break;
73 } 73 }
74 74
75 case type::literal: 75 case type::literal:
76 { 76 {
77 new(&literal_) std::string(other.literal_); 77 new(&literal_) std::string(other.literal_);
78 78
79 break; 79 break;
80 } 80 }
81 81
82 case type::verb: 82 case type::verb:
83 case type::adjective: 83 case type::adjective:
84 case type::adverb: 84 case type::adverb:
@@ -88,23 +88,23 @@ namespace verbly {
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 part::part(part&& other) : part() 92 part::part(part&& other) : part()
93 { 93 {
94 swap(*this, other); 94 swap(*this, other);
95 } 95 }
96 96
97 part& part::operator=(part other) 97 part& part::operator=(part other)
98 { 98 {
99 swap(*this, other); 99 swap(*this, other);
100 100
101 return *this; 101 return *this;
102 } 102 }
103 103
104 void swap(part& first, part& second) 104 void swap(part& first, part& second)
105 { 105 {
106 using type = part::type; 106 using type = part::type;
107 107
108 type tempType = first.type_; 108 type tempType = first.type_;
109 std::string tempRole; 109 std::string tempRole;
110 selrestr tempSelrestrs; 110 selrestr tempSelrestrs;
@@ -112,7 +112,7 @@ namespace verbly {
112 std::set<std::string> tempChoices; 112 std::set<std::string> tempChoices;
113 bool tempPrepLiteral; 113 bool tempPrepLiteral;
114 std::string tempLiteralValue; 114 std::string tempLiteralValue;
115 115
116 switch (tempType) 116 switch (tempType)
117 { 117 {
118 case type::noun_phrase: 118 case type::noun_phrase:
@@ -120,25 +120,25 @@ namespace verbly {
120 tempRole = std::move(first.noun_phrase_.role); 120 tempRole = std::move(first.noun_phrase_.role);
121 tempSelrestrs = std::move(first.noun_phrase_.selrestrs); 121 tempSelrestrs = std::move(first.noun_phrase_.selrestrs);
122 tempSynrestrs = std::move(first.noun_phrase_.synrestrs); 122 tempSynrestrs = std::move(first.noun_phrase_.synrestrs);
123 123
124 break; 124 break;
125 } 125 }
126 126
127 case type::preposition: 127 case type::preposition:
128 { 128 {
129 tempChoices = std::move(first.preposition_.choices); 129 tempChoices = std::move(first.preposition_.choices);
130 tempPrepLiteral = first.preposition_.literal; 130 tempPrepLiteral = first.preposition_.literal;
131 131
132 break; 132 break;
133 } 133 }
134 134
135 case type::literal: 135 case type::literal:
136 { 136 {
137 tempLiteralValue = std::move(first.literal_); 137 tempLiteralValue = std::move(first.literal_);
138 138
139 break; 139 break;
140 } 140 }
141 141
142 case type::verb: 142 case type::verb:
143 case type::adjective: 143 case type::adjective:
144 case type::adverb: 144 case type::adverb:
@@ -147,11 +147,11 @@ namespace verbly {
147 break; 147 break;
148 } 148 }
149 } 149 }
150 150
151 first.~part(); 151 first.~part();
152 152
153 first.type_ = second.type_; 153 first.type_ = second.type_;
154 154
155 switch (first.type_) 155 switch (first.type_)
156 { 156 {
157 case type::noun_phrase: 157 case type::noun_phrase:
@@ -159,25 +159,25 @@ namespace verbly {
159 new(&first.noun_phrase_.role) std::string(std::move(second.noun_phrase_.role)); 159 new(&first.noun_phrase_.role) std::string(std::move(second.noun_phrase_.role));
160 new(&first.noun_phrase_.selrestrs) selrestr(std::move(second.noun_phrase_.selrestrs)); 160 new(&first.noun_phrase_.selrestrs) selrestr(std::move(second.noun_phrase_.selrestrs));
161 new(&first.noun_phrase_.synrestrs) std::set<std::string>(std::move(second.noun_phrase_.synrestrs)); 161 new(&first.noun_phrase_.synrestrs) std::set<std::string>(std::move(second.noun_phrase_.synrestrs));
162 162
163 break; 163 break;
164 } 164 }
165 165
166 case type::preposition: 166 case type::preposition:
167 { 167 {
168 new(&first.preposition_.choices) std::set<std::string>(std::move(second.preposition_.choices)); 168 new(&first.preposition_.choices) std::set<std::string>(std::move(second.preposition_.choices));
169 first.preposition_.literal = second.preposition_.literal; 169 first.preposition_.literal = second.preposition_.literal;
170 170
171 break; 171 break;
172 } 172 }
173 173
174 case type::literal: 174 case type::literal:
175 { 175 {
176 new(&first.literal_) std::string(std::move(second.literal_)); 176 new(&first.literal_) std::string(std::move(second.literal_));
177 177
178 break; 178 break;
179 } 179 }
180 180
181 case type::verb: 181 case type::verb:
182 case type::adjective: 182 case type::adjective:
183 case type::adverb: 183 case type::adverb:
@@ -186,11 +186,11 @@ namespace verbly {
186 break; 186 break;
187 } 187 }
188 } 188 }
189 189
190 second.~part(); 190 second.~part();
191 191
192 second.type_ = tempType; 192 second.type_ = tempType;
193 193
194 switch (second.type_) 194 switch (second.type_)
195 { 195 {
196 case type::noun_phrase: 196 case type::noun_phrase:
@@ -198,25 +198,25 @@ namespace verbly {
198 new(&second.noun_phrase_.role) std::string(std::move(tempRole)); 198 new(&second.noun_phrase_.role) std::string(std::move(tempRole));
199 new(&second.noun_phrase_.selrestrs) selrestr(std::move(tempSelrestrs)); 199 new(&second.noun_phrase_.selrestrs) selrestr(std::move(tempSelrestrs));
200 new(&second.noun_phrase_.synrestrs) std::set<std::string>(std::move(tempSynrestrs)); 200 new(&second.noun_phrase_.synrestrs) std::set<std::string>(std::move(tempSynrestrs));
201 201
202 break; 202 break;
203 } 203 }
204 204
205 case type::preposition: 205 case type::preposition:
206 { 206 {
207 new(&second.preposition_.choices) std::set<std::string>(std::move(tempChoices)); 207 new(&second.preposition_.choices) std::set<std::string>(std::move(tempChoices));
208 second.preposition_.literal = tempPrepLiteral; 208 second.preposition_.literal = tempPrepLiteral;
209 209
210 break; 210 break;
211 } 211 }
212 212
213 case type::literal: 213 case type::literal:
214 { 214 {
215 new(&second.literal_) std::string(std::move(tempLiteralValue)); 215 new(&second.literal_) std::string(std::move(tempLiteralValue));
216 216
217 break; 217 break;
218 } 218 }
219 219
220 case type::verb: 220 case type::verb:
221 case type::adjective: 221 case type::adjective:
222 case type::adverb: 222 case type::adverb:
@@ -226,7 +226,7 @@ namespace verbly {
226 } 226 }
227 } 227 }
228 } 228 }
229 229
230 part::~part() 230 part::~part()
231 { 231 {
232 switch (type_) 232 switch (type_)
@@ -235,32 +235,32 @@ namespace verbly {
235 { 235 {
236 using string_type = std::string; 236 using string_type = std::string;
237 using set_type = std::set<std::string>; 237 using set_type = std::set<std::string>;
238 238
239 noun_phrase_.role.~string_type(); 239 noun_phrase_.role.~string_type();
240 noun_phrase_.selrestrs.~selrestr(); 240 noun_phrase_.selrestrs.~selrestr();
241 noun_phrase_.synrestrs.~set_type(); 241 noun_phrase_.synrestrs.~set_type();
242 242
243 break; 243 break;
244 } 244 }
245 245
246 case type::preposition: 246 case type::preposition:
247 { 247 {
248 using set_type = std::set<std::string>; 248 using set_type = std::set<std::string>;
249 249
250 preposition_.choices.~set_type(); 250 preposition_.choices.~set_type();
251 251
252 break; 252 break;
253 } 253 }
254 254
255 case type::literal: 255 case type::literal:
256 { 256 {
257 using string_type = std::string; 257 using string_type = std::string;
258 258
259 literal_.~string_type(); 259 literal_.~string_type();
260 260
261 break; 261 break;
262 } 262 }
263 263
264 case type::verb: 264 case type::verb:
265 case type::adjective: 265 case type::adjective:
266 case type::adverb: 266 case type::adverb:
@@ -270,7 +270,7 @@ namespace verbly {
270 } 270 }
271 } 271 }
272 } 272 }
273 273
274 std::string part::getNounRole() const 274 std::string part::getNounRole() const
275 { 275 {
276 if (type_ == type::noun_phrase) 276 if (type_ == type::noun_phrase)
@@ -280,7 +280,7 @@ namespace verbly {
280 throw std::domain_error("part::getNounRole is only valid for noun phrase parts"); 280 throw std::domain_error("part::getNounRole is only valid for noun phrase parts");
281 } 281 }
282 } 282 }
283 283
284 selrestr part::getNounSelrestrs() const 284 selrestr part::getNounSelrestrs() const
285 { 285 {
286 if (type_ == type::noun_phrase) 286 if (type_ == type::noun_phrase)
@@ -290,7 +290,7 @@ namespace verbly {
290 throw std::domain_error("part::getNounSelrestrs is only valid for noun phrase parts"); 290 throw std::domain_error("part::getNounSelrestrs is only valid for noun phrase parts");
291 } 291 }
292 } 292 }
293 293
294 std::set<std::string> part::getNounSynrestrs() const 294 std::set<std::string> part::getNounSynrestrs() const
295 { 295 {
296 if (type_ == type::noun_phrase) 296 if (type_ == type::noun_phrase)
@@ -300,7 +300,7 @@ namespace verbly {
300 throw std::domain_error("part::getNounSynrestrs is only valid for noun phrase parts"); 300 throw std::domain_error("part::getNounSynrestrs is only valid for noun phrase parts");
301 } 301 }
302 } 302 }
303 303
304 std::set<std::string> part::getPrepositionChoices() const 304 std::set<std::string> part::getPrepositionChoices() const
305 { 305 {
306 if (type_ == type::preposition) 306 if (type_ == type::preposition)
@@ -310,7 +310,7 @@ namespace verbly {
310 throw std::domain_error("part::getPrepositionChoices is only valid for preposition parts"); 310 throw std::domain_error("part::getPrepositionChoices is only valid for preposition parts");
311 } 311 }
312 } 312 }
313 313
314 bool part::isPrepositionLiteral() const 314 bool part::isPrepositionLiteral() const
315 { 315 {
316 if (type_ == type::preposition) 316 if (type_ == type::preposition)
@@ -320,7 +320,7 @@ namespace verbly {
320 throw std::domain_error("part::isPrepositionLiteral is only valid for preposition parts"); 320 throw std::domain_error("part::isPrepositionLiteral is only valid for preposition parts");
321 } 321 }
322 } 322 }
323 323
324 std::string part::getLiteralValue() const 324 std::string part::getLiteralValue() const
325 { 325 {
326 if (type_ == type::literal) 326 if (type_ == type::literal)
@@ -330,6 +330,6 @@ namespace verbly {
330 throw std::domain_error("part::getLiteralValue is only valid for literal parts"); 330 throw std::domain_error("part::getLiteralValue is only valid for literal parts");
331 } 331 }
332 } 332 }
333 333
334 }; 334 };
335}; 335};
diff --git a/generator/part.h b/generator/part.h index 86d5d57..b010f62 100644 --- a/generator/part.h +++ b/generator/part.h
@@ -7,7 +7,7 @@
7 7
8namespace verbly { 8namespace verbly {
9 namespace generator { 9 namespace generator {
10 10
11 class part { 11 class part {
12 public: 12 public:
13 enum class type { 13 enum class type {
@@ -19,78 +19,78 @@ namespace verbly {
19 adverb = 4, 19 adverb = 4,
20 literal = 5 20 literal = 5
21 }; 21 };
22 22
23 // Static factories 23 // Static factories
24 24
25 static part createNounPhrase(std::string role, selrestr selrestrs, std::set<std::string> synrestrs); 25 static part createNounPhrase(std::string role, selrestr selrestrs, std::set<std::string> synrestrs);
26 26
27 static part createVerb(); 27 static part createVerb();
28 28
29 static part createPreposition(std::set<std::string> choices, bool literal); 29 static part createPreposition(std::set<std::string> choices, bool literal);
30 30
31 static part createAdjective(); 31 static part createAdjective();
32 32
33 static part createAdverb(); 33 static part createAdverb();
34 34
35 static part createLiteral(std::string value); 35 static part createLiteral(std::string value);
36 36
37 // Copy and move constructors 37 // Copy and move constructors
38 38
39 part(const part& other); 39 part(const part& other);
40 40
41 part(part&& other); 41 part(part&& other);
42 42
43 // Assignment 43 // Assignment
44 44
45 part& operator=(part other); 45 part& operator=(part other);
46 46
47 // Swap 47 // Swap
48 48
49 friend void swap(part& first, part& second); 49 friend void swap(part& first, part& second);
50 50
51 // Destructor 51 // Destructor
52 52
53 ~part(); 53 ~part();
54 54
55 // General accessors 55 // General accessors
56 56
57 type getType() const 57 type getType() const
58 { 58 {
59 return type_; 59 return type_;
60 } 60 }
61 61
62 // Noun phrase accessors 62 // Noun phrase accessors
63 63
64 std::string getNounRole() const; 64 std::string getNounRole() const;
65 65
66 selrestr getNounSelrestrs() const; 66 selrestr getNounSelrestrs() const;
67 67
68 std::set<std::string> getNounSynrestrs() const; 68 std::set<std::string> getNounSynrestrs() const;
69 69
70 // Preposition accessors 70 // Preposition accessors
71 71
72 std::set<std::string> getPrepositionChoices() const; 72 std::set<std::string> getPrepositionChoices() const;
73 73
74 bool isPrepositionLiteral() const; 74 bool isPrepositionLiteral() const;
75 75
76 // Literal accessors 76 // Literal accessors
77 77
78 std::string getLiteralValue() const; 78 std::string getLiteralValue() const;
79 79
80 private: 80 private:
81 81
82 // Private constructors 82 // Private constructors
83 83
84 part() 84 part()
85 { 85 {
86 } 86 }
87 87
88 part(type t) : type_(t) 88 part(type t) : type_(t)
89 { 89 {
90 } 90 }
91 91
92 // Data 92 // Data
93 93
94 union { 94 union {
95 struct { 95 struct {
96 std::string role; 96 std::string role;
@@ -103,11 +103,11 @@ namespace verbly {
103 } preposition_; 103 } preposition_;
104 std::string literal_; 104 std::string literal_;
105 }; 105 };
106 106
107 type type_ = type::invalid; 107 type type_ = type::invalid;
108 108
109 }; 109 };
110 110
111 }; 111 };
112}; 112};
113 113
diff --git a/generator/progress.h b/generator/progress.h index fcb680d..76cde48 100644 --- a/generator/progress.h +++ b/generator/progress.h
@@ -5,20 +5,20 @@
5 5
6namespace verbly { 6namespace verbly {
7 namespace generator { 7 namespace generator {
8 8
9 class progress { 9 class progress {
10 private: 10 private:
11 std::string message; 11 std::string message;
12 int total; 12 int total;
13 int cur = 0; 13 int cur = 0;
14 int lprint = 0; 14 int lprint = 0;
15 15
16 public: 16 public:
17 progress(std::string message, int total) : message(message), total(total) 17 progress(std::string message, int total) : message(message), total(total)
18 { 18 {
19 std::cout << message << " 0%" << std::flush; 19 std::cout << message << " 0%" << std::flush;
20 } 20 }
21 21
22 void update(int val) 22 void update(int val)
23 { 23 {
24 if (val <= total) 24 if (val <= total)
@@ -27,29 +27,29 @@ namespace verbly {
27 } else { 27 } else {
28 cur = total; 28 cur = total;
29 } 29 }
30 30
31 int pp = cur * 100 / total; 31 int pp = cur * 100 / total;
32 if (pp != lprint) 32 if (pp != lprint)
33 { 33 {
34 lprint = pp; 34 lprint = pp;
35 35
36 std::cout << "\b\b\b\b" << std::right; 36 std::cout << "\b\b\b\b" << std::right;
37 std::cout.width(3); 37 std::cout.width(3);
38 std::cout << pp << "%" << std::flush; 38 std::cout << pp << "%" << std::flush;
39 } 39 }
40 } 40 }
41 41
42 void update() 42 void update()
43 { 43 {
44 update(cur+1); 44 update(cur+1);
45 } 45 }
46 46
47 ~progress() 47 ~progress()
48 { 48 {
49 std::cout << "\b\b\b\b100%" << std::endl; 49 std::cout << "\b\b\b\b100%" << std::endl;
50 } 50 }
51 }; 51 };
52 52
53 }; 53 };
54}; 54};
55 55
diff --git a/generator/word.cpp b/generator/word.cpp index 8ba3ce2..b3fc490 100644 --- a/generator/word.cpp +++ b/generator/word.cpp
@@ -37,7 +37,7 @@ namespace verbly {
37 { 37 {
38 adjectivePosition_ = adjectivePosition; 38 adjectivePosition_ = adjectivePosition;
39 } 39 }
40 40
41 void word::setVerbGroup(const group& verbGroup) 41 void word::setVerbGroup(const group& verbGroup)
42 { 42 {
43 verbGroup_ = &verbGroup; 43 verbGroup_ = &verbGroup;
@@ -46,7 +46,7 @@ namespace verbly {
46 database& operator<<(database& db, const word& arg) 46 database& operator<<(database& db, const word& arg)
47 { 47 {
48 std::list<field> fields; 48 std::list<field> fields;
49 49
50 fields.emplace_back("word_id", arg.getId()); 50 fields.emplace_back("word_id", arg.getId());
51 fields.emplace_back("notion_id", arg.getNotion().getId()); 51 fields.emplace_back("notion_id", arg.getNotion().getId());
52 fields.emplace_back("lemma_id", arg.getLemma().getId()); 52 fields.emplace_back("lemma_id", arg.getLemma().getId());
@@ -55,13 +55,13 @@ namespace verbly {
55 { 55 {
56 fields.emplace_back("tag_count", arg.getTagCount()); 56 fields.emplace_back("tag_count", arg.getTagCount());
57 } 57 }
58 58
59 if ((arg.getNotion().getPartOfSpeech() == part_of_speech::adjective) 59 if ((arg.getNotion().getPartOfSpeech() == part_of_speech::adjective)
60 && (arg.getAdjectivePosition() != positioning::undefined)) 60 && (arg.getAdjectivePosition() != positioning::undefined))
61 { 61 {
62 fields.emplace_back("position", static_cast<int>(arg.getAdjectivePosition())); 62 fields.emplace_back("position", static_cast<int>(arg.getAdjectivePosition()));
63 } 63 }
64 64
65 if ((arg.getNotion().getPartOfSpeech() == part_of_speech::verb) 65 if ((arg.getNotion().getPartOfSpeech() == part_of_speech::verb)
66 && (arg.hasVerbGroup())) 66 && (arg.hasVerbGroup()))
67 { 67 {
diff --git a/generator/word.h b/generator/word.h index 1d77ed3..a994ec3 100644 --- a/generator/word.h +++ b/generator/word.h
@@ -24,7 +24,7 @@ namespace verbly {
24 // Mutators 24 // Mutators
25 25
26 void setAdjectivePosition(positioning adjectivePosition); 26 void setAdjectivePosition(positioning adjectivePosition);
27 27
28 void setVerbGroup(const group& verbGroup); 28 void setVerbGroup(const group& verbGroup);
29 29
30 // Accessors 30 // Accessors
@@ -58,7 +58,7 @@ namespace verbly {
58 { 58 {
59 return hasTagCount_; 59 return hasTagCount_;
60 } 60 }
61 61
62 int getTagCount() const 62 int getTagCount() const
63 { 63 {
64 // Calling code should always call hasTagCount first. 64 // Calling code should always call hasTagCount first.
@@ -71,17 +71,17 @@ namespace verbly {
71 { 71 {
72 return adjectivePosition_; 72 return adjectivePosition_;
73 } 73 }
74 74
75 bool hasVerbGroup() const 75 bool hasVerbGroup() const
76 { 76 {
77 return (verbGroup_ != nullptr); 77 return (verbGroup_ != nullptr);
78 } 78 }
79 79
80 const group& getVerbGroup() const 80 const group& getVerbGroup() const
81 { 81 {
82 // Calling code should always call hasVerbGroup first. 82 // Calling code should always call hasVerbGroup first.
83 assert(verbGroup_ != nullptr); 83 assert(verbGroup_ != nullptr);
84 84
85 return *verbGroup_; 85 return *verbGroup_;
86 } 86 }
87 87