Morfeusz.hpp
1.45 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
61
/*
* File: Morfeusz.hpp
* Author: lennyn
*
* Created on November 13, 2013, 5:21 PM
*/
#ifndef MORFEUSZ_HPP
#define MORFEUSZ_HPP
#include <string>
#include <vector>
#include "EncodedInterpretation.hpp"
#include "fsa.hpp"
#include "MorphInterpretation.hpp"
#include "encoding/CharsetConverter.hpp"
class Morfeusz;
class AnalyzeResult;
class ResultsIterator;
class Morfeusz {
public:
explicit Morfeusz(const std::string& filename);
virtual ~Morfeusz();
// Morfeusz(const Morfeusz& orig);
AnalyzeResult analyze(const std::string& text);
// Morfeusz();
private:
void processOneWord(const char*& inputData, int startNodeNum, std::vector<MorphInterpretation>& resInterps);
const FSA<std::vector<EncodedInterpretation>>* fsa;
CharsetConverter* charsetConverter;
};
class ResultsIterator {
public:
ResultsIterator(
const char* startOfInput,
const char* endOfInput,
const Morfeusz& morfeusz);
virtual ~ResultsIterator();
// ResultsIterator(int* x);
ResultsIterator(const ResultsIterator& mit);
ResultsIterator& operator++();
ResultsIterator operator++(int);
bool operator==(const ResultsIterator& rhs);
bool operator!=(const ResultsIterator& rhs);
MorphInterpretation& operator*();
private:
const char* rawInput;
const char* endOfInput;
};
struct AnalyzeResult {
ResultsIterator iterator;
const ResultsIterator end;
};
#endif /* MORFEUSZ_HPP */