librime 1.2
Rime Input Method Engine, the core library
spelling.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2012-01-17 GONG Chen <chen.sst@gmail.com>
6//
7
8#ifndef RIME_SPELLING_H_
9#define RIME_SPELLING_H_
10
11#include <rime/common.h>
12
13namespace rime {
14
22};
23
26 size_t end_pos = 0;
27 double credibility = 0.0;
28 string tips;
29 bool is_correction = false;
30
31 // 疊加運算規則, 將運算規則產生的屬性應用到當前拼寫上
32 void Compose(const SpellingProperties& delta);
33 // 更新優化拼寫, 將另一個候選拼寫合併到當前記錄
34 void Update(const SpellingProperties& other);
35};
36
37struct Spelling {
38 string str;
40
41 Spelling() = default;
42 Spelling(const string& _str) : str(_str) {}
43
44 bool operator==(const Spelling& other) { return str == other.str; }
45 bool operator<(const Spelling& other) { return str < other.str; }
46};
47
48} // namespace rime
49
50#endif // RIME_SPELLING_H_
Definition algebra.cc:12
SpellingType
Definition spelling.h:15
@ kAbbreviation
Definition spelling.h:18
@ kInvalidSpelling
Definition spelling.h:21
@ kNormalSpelling
Definition spelling.h:16
@ kFuzzySpelling
Definition spelling.h:17
@ kAmbiguousSpelling
Definition spelling.h:20
@ kCompletion
Definition spelling.h:19
Definition spelling.h:24
void Update(const SpellingProperties &other)
Definition spelling.cc:22
SpellingType type
Definition spelling.h:25
size_t end_pos
Definition spelling.h:26
bool is_correction
Definition spelling.h:29
double credibility
Definition spelling.h:27
string tips
Definition spelling.h:28
void Compose(const SpellingProperties &delta)
Definition spelling.cc:5
bool operator<(const Spelling &other)
Definition spelling.h:45
Spelling(const string &_str)
Definition spelling.h:42
bool operator==(const Spelling &other)
Definition spelling.h:44
Spelling()=default
string str
Definition spelling.h:38
SpellingProperties properties
Definition spelling.h:39