-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBitmapManager.h
45 lines (39 loc) · 1.42 KB
/
BitmapManager.h
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
//
// BitmapManager.h
// BitmapIndex
//
// Created on 08.02.13.
// Copyright (c) 2013 Christoph Schaefer. All rights reserved.
//
#ifndef __BitmapIndex__BitmapManager__
#define __BitmapIndex__BitmapManager__
#include <iostream>
#include "forward.h"
class BitmapManager {
public:
BitmapManager();
virtual ~BitmapManager(){};
void addSourceTargetScore(const std::string& source,
const std::string& target,
float score);
void flushSourceTargetScore();
StringVecPtr getTargets(const std::string& source, const std::wstring& target);
uint64_t getRowCount() { return _rowCount; }
void writeToDisc(const std::string& path);
void readFromDisc(const std::string& path);
bool isInAlphabet(const std::wstring& target);
bool isInAlphabet(const wchar_t& c);
private:
PartitionMap _sourceCharPartitionMap;
CharBitmapMap _targetCharBitmapMap;
std::vector<CharBitmapMap> _targetCharPositionBitmaps;
uint64_t _rowCount;
StringVecPtr _targetPtr;
std::shared_ptr<std::vector<float>> _scorePtr;
SourceHashMapPtr _sourceHashMapPtr;
BitmapPtr _resultBitmap;
const uint16_t MAX_TARGET_LENGTH = 5;
const std::wstring ALPHABET = L"0123456789AÄBCDEFGHIJKLMNOÖPQRSTUÜVWXYZaäbcdefghijklmnoöpqrsßtuüvwxyz,.-:?!;'";
void addTarget(const std::wstring& target);
};
#endif /* defined(__BitmapIndex__BitmapManager__) */