-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingleton_diction.h
More file actions
35 lines (27 loc) · 817 Bytes
/
singleton_diction.h
File metadata and controls
35 lines (27 loc) · 817 Bytes
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
#ifndef __SINGLETON_DICTION__
#define __SINGLETON_DICTION__
#include <string>
#include <unordered_set>
class SingletonDiction
{
#ifdef UTFLAG
public:
#else
private:
#endif
std::unordered_set<std::string> uset_dictionary_;
SingletonDiction() = default;
SingletonDiction(const SingletonDiction&) = delete;
SingletonDiction& operator=(const SingletonDiction&) = delete;
public:
~SingletonDiction() = default;
// Hungry Singleton
static SingletonDiction& GetInstance();
// Read dictionary from disk to memory
void Init();
// Build word piece with minimal character size 2, this will be used as the base for lookup.
void BuildWordPiece();
// Lookup the str_letters to see if exists in dictionary
bool LookupDict(std::string str_letters);
};
#endif