librime 1.2
Rime Input Method Engine, the core library
preset_vocabulary.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2011-11-27 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef PRESET_VOCABULARY_H_
8#define PRESET_VOCABULARY_H_
9
10#include <rime/common.h>
11
12namespace rime {
13
14struct VocabularyDb;
15
17 public:
18 explicit PresetVocabulary(const string& vocabulary);
20
21 // random access
22 bool GetWeightForEntry(const string& key, double* weight);
23 // traversing
24 void Reset();
25 bool GetNextEntry(string* key, string* value);
26 bool IsQualifiedPhrase(const string& phrase, const string& weight_str);
27
28 void set_max_phrase_length(int length) { max_phrase_length_ = length; }
29 void set_min_phrase_weight(double weight) { min_phrase_weight_ = weight; }
30
31 static path DictFilePath(const string& vacabulary);
32
33 protected:
36 double min_phrase_weight_ = 0.0;
37};
38
39} // namespace rime
40
41#endif // PRESET_VOCABULARY_H_
Definition algebra.cc:12
std::unique_ptr< T > the
Definition common.h:58
Definition common.h:84
Definition preset_vocabulary.cc:17
void Reset()
Definition preset_vocabulary.cc:85
void set_min_phrase_weight(double weight)
Definition preset_vocabulary.h:29
the< VocabularyDb > db_
Definition preset_vocabulary.h:34
PresetVocabulary(const string &vocabulary)
Definition preset_vocabulary.cc:61
bool GetNextEntry(string *key, string *value)
Definition preset_vocabulary.cc:90
bool IsQualifiedPhrase(const string &phrase, const string &weight_str)
Definition preset_vocabulary.cc:100
bool GetWeightForEntry(const string &key, double *weight)
Definition preset_vocabulary.cc:73
static path DictFilePath(const string &vacabulary)
Definition preset_vocabulary.cc:55
int max_phrase_length_
Definition preset_vocabulary.h:35
double min_phrase_weight_
Definition preset_vocabulary.h:36
void set_max_phrase_length(int length)
Definition preset_vocabulary.h:28