-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhal2012-database2012.h
82 lines (66 loc) · 1.92 KB
/
hal2012-database2012.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* hal2012-database2012.h
*
* Created on: 07.06.2012
* Author: tobias
*/
#ifndef HAL2012_DATABASE2012_H_
#define HAL2012_DATABASE2012_H_
#include "hal2012-util2012.h"
#include "hal2012-xml2012.h"
#include "hal2012-tagger2012.h"
#include "hal2012-filterfacts2012.h"
#include "hal2012-serialization.h"
namespace grammar2012 {
// this resolves the chicken or egg causality dilemma between
// hal2012-xml2012.h and hal2012-database2012.h because both include both
class xml_fact;
template<typename DB>
class database : public freehal_base {
private:
tagger* t;
// IO variables
typedef boost::unordered_map<string, uintmax_t> filesmap;
filesmap files;
// I/O
int resume();
int suspend();
int read_xml_fact_file(const fs::path, DB*);
public:
// constructor, destructor
database();
~database();
// I/O
int prepare(const fs::path&);
int prepare(const fs::path&, const fs::path&);
int find_by_word(vector<boost::shared_ptr<xml_fact> >&, const word&);
int find_by_words(vector<boost::shared_ptr<xml_fact> >&,
const vector<word>&);
int find_by_fact(vector<boost::shared_ptr<xml_fact> >&,
boost::shared_ptr<xml_fact>);
int get_synonyms(vector<word>&, const word& w);
// XML
boost::shared_ptr<xml_obj> insert_synonyms(boost::shared_ptr<xml_obj>);
// environment variables
void set_lang(const string&);
void set_path(const fs::path& _path);
bool is_configured() const;
void set_tagger(tagger*);
tagger* get_tagger() const;
// cache algorithm
template<typename T1, typename T2>
const fs::path disk_find_file(const string, T1, T1, T1, T1, T2);
template<typename M>
int disk_read_file(const fs::path&, M&);
template<typename M>
int disk_write_file(const fs::path&, const M&);
private:
// serialization
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version) {
}
};
}
#include "hal2012-database2012.hpp"
#endif /* HAL2012_DATABASE2012_H_ */