1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
#ifndef GENERATOR_H_5B61CBC5
#define GENERATOR_H_5B61CBC5
#include <string>
#include <map>
#include <list>
#include <set>
#include <libxml/parser.h>
#include <hkutil/database.h>
#include "notion.h"
#include "word.h"
#include "lemma.h"
#include "form.h"
#include "pronunciation.h"
#include "group.h"
#include "frame.h"
namespace verbly {
enum class part_of_speech;
namespace generator {
class generator {
public:
// Constructor
generator(
std::string verbNetPath,
std::string agidPath,
std::string wordNetPath,
std::string cmudictPath,
std::string imageNetPath,
std::string outputPath);
// Action
void run();
private:
// Subroutines
void readWordNetSynsets();
void readAdjectivePositioning();
void readImageNetUrls();
void readWordNetSenseKeys();
void readVerbNet();
void readAgidInflections();
void readPrepositions();
void readCmudictPronunciations();
void writeSchema();
void writeVersion();
void dumpObjects();
void readWordNetAntonymy();
void readWordNetVariation();
void readWordNetClasses();
void readWordNetCausality();
void readWordNetEntailment();
void readWordNetHypernymy();
void readWordNetInstantiation();
void readWordNetMemberMeronymy();
void readWordNetPartMeronymy();
void readWordNetSubstanceMeronymy();
void readWordNetPertainymy();
void readWordNetSpecification();
void readWordNetSimilarity();
void analyzeDatabase();
// Helpers
std::list<std::string> readFile(std::string path, bool uniq = false);
inline part_of_speech partOfSpeechByWnid(int wnid);
notion& createNotion(part_of_speech partOfSpeech);
notion& lookupOrCreateNotion(int wnid);
lemma& lookupOrCreateLemma(std::string base_form);
form& lookupOrCreateForm(std::string text);
template <typename... Args> word& createWord(Args&&... args);
void createGroup(xmlNodePtr top, const group* parent = nullptr);
// Input
std::string verbNetPath_;
std::string agidPath_;
std::string wordNetPath_;
std::string cmudictPath_;
std::string imageNetPath_;
// Output
hatkirby::database db_;
// Data
std::list<notion> notions_;
std::list<word> words_;
std::list<lemma> lemmas_;
std::list<form> forms_;
std::list<pronunciation> pronunciations_;
std::list<group> groups_;
// Indexes
std::map<int, notion*> notionByWnid_;
std::map<int, std::set<word*>> wordsByWnid_;
std::map<std::pair<int, int>, word*> wordByWnidAndWnum_;
std::map<std::string, std::set<word*>> wordsByBaseForm_;
std::map<std::string, lemma*> lemmaByBaseForm_;
std::map<std::string, form*> formByText_;
std::map<std::string, pronunciation*> pronunciationByPhonemes_;
// Caches
std::map<std::string, word*> wnSenseKeys_;
};
};
};
#endif /* end of include guard: GENERATOR_H_5B61CBC5 */
|