blob: 3bff9168add7e031731104e2650750dc95e68344 (
plain) (
blame)
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
|
#ifndef NOTION_H_221DE2BC
#define NOTION_H_221DE2BC
#include <list>
#include <string>
#include <hkutil/database.h>
#include "../lib/enums.h"
namespace verbly {
namespace generator {
class notion {
public:
// Constructors
explicit notion(part_of_speech partOfSpeech);
notion(part_of_speech partOfSpeech, int wnid);
// Mutators
void incrementNumOfImages();
void setPrepositionGroups(std::list<std::string> groups);
// Accessors
int getId() const
{
return id_;
}
part_of_speech getPartOfSpeech() const
{
return partOfSpeech_;
}
bool hasWnid() const
{
return hasWnid_;
}
int getWnid() const
{
if (!hasWnid_)
{
throw std::domain_error("Notion does not have wnid");
}
return wnid_;
}
int getNumOfImages() const
{
if (!hasWnid_ || (partOfSpeech_ != part_of_speech::noun))
{
throw std::domain_error("Notion is not a noun with wnid");
}
return numOfImages_;
}
std::list<std::string> getPrepositionGroups() const
{
if (partOfSpeech_ != part_of_speech::preposition)
{
throw std::domain_error("Notion is not a preposition");
}
return prepositionGroups_;
}
private:
static int nextId_;
const int id_;
const part_of_speech partOfSpeech_;
const int wnid_ = 0;
const bool hasWnid_ = false;
int numOfImages_ = 0;
std::list<std::string> prepositionGroups_;
};
// Serializer
hatkirby::database& operator<<(hatkirby::database& db, const notion& arg);
};
};
#endif /* end of include guard: NOTION_H_221DE2BC */
|