FlexionGraph.hpp
1.18 KB
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
/*
* File: FlexionGraph.hpp
* Author: mlenart
*
* Created on 18 listopad 2013, 15:03
*/
#ifndef FLEXIONGRAPH_HPP
#define FLEXIONGRAPH_HPP
#include <vector>
#include "InterpretedChunk.hpp"
struct Edge {
InterpretedChunk chunk;
int nextNode;
};
//struct EdgeLabel {
// int type;
// const char* textStart;
// int textLength;
//
// bool operator==(const EdgeLabel &el) const {
// return this->type == el.type
// && this->textStart == el.textStart
// && this->textLength == el.textLength;
// }
//
// bool operator<(const coord &o) {
// return x < o.x || (x == o.x && y < o.y);
// }
//};
class FlexionGraph {
public:
explicit FlexionGraph(int startNode);
void addPath(const std::vector<InterpretedChunk>& path);
void appendToResults(const Tagset& tagset, std::vector<MorphInterpretation>& results);
bool empty() const;
// virtual ~FlexionGraph();
private:
void addStartEdge(const Edge& e);
void addMiddleEdge(const Edge& e);
void minimizeGraph();
int startNode;
std::vector< std::vector<Edge> > graph;
};
#endif /* FLEXIONGRAPH_HPP */