InterpretedChunksDecoder4Analyzer.hpp
1.61 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
/*
* File: InterpretedChunksDecoder4Analyzer.hpp
* Author: mlenart
*
* Created on 15 maj 2014, 15:28
*/
#ifndef INTERPRETEDCHUNKSDECODER4ANALYZER_HPP
#define INTERPRETEDCHUNKSDECODER4ANALYZER_HPP
#include "InterpretedChunksDecoder.hpp"
struct DecodeMorphInterpParams {
unsigned int startNode;
unsigned int endNode;
const string& orth;
const string& lemmaPrefix;
const InterpretedChunk& chunk;
bool forPrefix;
};
class InterpretedChunksDecoder4Analyzer : public InterpretedChunksDecoder {
public:
InterpretedChunksDecoder4Analyzer(const Environment& env);
void decode(
unsigned int startNode,
unsigned int endNode,
const InterpretedChunk& interpretedChunk,
std::vector<MorphInterpretation>& out) const;
private:
void decodeLemma(
const vector<uint32_t>& orth,
const EncodedForm& lemma,
bool forPrefix,
string& res) const;
void deserializeEncodedForm(const unsigned char*& ptr, unsigned char compressionByte, EncodedForm& encodedForm) const;
EncodedInterpretation deserializeEncodedInterp(const unsigned char*& ptr, unsigned char compressionByte) const;
void decodeMorphInterpretation(const DecodeMorphInterpParams& params, const unsigned char*& ptr, std::vector<MorphInterpretation>& out) const;
bool convertPrefixes(const InterpretedChunk& interpretedChunk, std::string& orth, std::string& lemmaPrefix) const;
mutable std::vector<uint32_t> orthCodepoints;
mutable std::vector<uint32_t> normalizedCodepoints;
};
#endif /* INTERPRETEDCHUNKSDECODER4ANALYZER_HPP */