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
|
#include "word.h"
#include <list>
#include <string>
#include "notion.h"
#include "lemma.h"
#include "group.h"
namespace verbly {
namespace generator {
int word::nextId_ = 0;
word::word(
notion& n,
lemma& l) :
id_(nextId_++),
notion_(n),
lemma_(l)
{
}
word::word(
notion& n,
lemma& l,
int tagCount) :
id_(nextId_++),
notion_(n),
lemma_(l),
tagCount_(tagCount),
hasTagCount_(true)
{
}
void word::setAdjectivePosition(positioning adjectivePosition)
{
adjectivePosition_ = adjectivePosition;
}
void word::setVerbGroup(const group& verbGroup)
{
verbGroup_ = &verbGroup;
}
hatkirby::database& operator<<(hatkirby::database& db, const word& arg)
{
std::list<hatkirby::column> fields;
fields.emplace_back("word_id", arg.getId());
fields.emplace_back("notion_id", arg.getNotion().getId());
fields.emplace_back("lemma_id", arg.getLemma().getId());
if (arg.hasTagCount())
{
fields.emplace_back("tag_count", arg.getTagCount());
}
if ((arg.getNotion().getPartOfSpeech() == part_of_speech::adjective)
&& (arg.getAdjectivePosition() != positioning::undefined))
{
fields.emplace_back("position",
static_cast<int>(arg.getAdjectivePosition()));
}
if ((arg.getNotion().getPartOfSpeech() == part_of_speech::verb)
&& (arg.hasVerbGroup()))
{
fields.emplace_back("group_id", arg.getVerbGroup().getId());
}
db.insertIntoTable("words", std::move(fields));
return db;
}
};
};
|