InterpretedChunksDecoder4Analyzer.hpp
1.69 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
/*
* 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 std::string& orth;
const std::string& lemma4Prefixes;
const InterpretedChunk& chunk;
};
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 EncodedForm& lemma,
int realOrthCodepointsNum,
bool forPrefix,
std::string& res) const;
void decodeEncodedForm(const unsigned char*& ptr, unsigned char compressionByte, EncodedForm& encodedForm) const;
EncodedInterpretation decodeEncodedInterp(const unsigned char*& ptr, unsigned char compressionByte) const;
void decodeMorphInterpretation(const DecodeMorphInterpParams& params, const unsigned char*& ptr, std::vector<MorphInterpretation>& out) const;
bool tryToGetLemma4Prefixes(const InterpretedChunk& interpretedChunk, std::string& lemma4Prefixes) const;
bool tryToGetLemma4OnePrefix(const InterpretedChunk& prefixChunk, std::string& lemma4Prefixes) const;
mutable std::vector<uint32_t> orthCodepoints;
mutable std::vector<uint32_t> normalizedCodepoints;
};
#endif /* INTERPRETEDCHUNKSDECODER4ANALYZER_HPP */