blob: c235890f8bdebc3bd2765d7df2f8aa79c00f3f5f (
plain)
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
|
#pragma once
#include "common.hpp"
#include "../base/base.hpp"
#include "../std/function.hpp"
#include "../std/scoped_ptr.hpp"
#include "../std/string.hpp"
#include "../std/utility.hpp"
class FileReader;
namespace sl
{
class Dictionary;
class SortedIndex;
class SloynikEngine
{
public:
SloynikEngine(string const & dictionary,
string const & index,
sl::StrFn const & strFn);
~SloynikEngine();
typedef uint32_t WordId;
struct WordInfo
{
string m_Word;
};
void GetWordInfo(WordId word, WordInfo & res) const;
struct SearchResult
{
SearchResult() : m_FirstMatched(0) {}
WordId m_FirstMatched;
};
void Search(string const & prefix, SearchResult & res) const;
uint32_t WordCount() const;
struct ArticleData
{
string m_HTML;
void swap(ArticleData & o)
{
m_HTML.swap(o.m_HTML);
}
};
void GetArticleData(WordId word, ArticleData & data) const;
private:
scoped_ptr<sl::Dictionary> m_pDictionary;
//scoped_ptr<FileReader> m_pIndexReader;
scoped_ptr<sl::SortedIndex> m_pSortedIndex;
};
}
|