| 1 | //cxx . . $ `<file>/src/rime/algo/spelling.h`/ |
| 2 | // Copyright RIME Developers |
| 3 | // Distributed under the BSD License |
| 4 | // |
| 5 | // 2012-01-17 GONG Chen <[email protected]> |
| 6 | // |
| 7 | |
| 8 | #ifndef RIME_SPELLING_H_ |
| 9 | #define RIME_SPELLING_H_cxx . . $ `src/rime/algo/spelling.h:9:9`! |
| 10 | |
| 11 | #include <rime/common.h>cxx . . $ `<file>/src/rime/common.h`/ |
| 12 | |
| 13 | namespace rimecxx . . $ rime/ { |
| 14 | |
| 15 | enum SpellingTypecxx . . $ rime/SpellingType# { |
| 16 | kNormalSpellingcxx . . $ rime/kNormalSpelling., |
| 17 | kFuzzySpellingcxx . . $ rime/kFuzzySpelling., |
| 18 | kAbbreviationcxx . . $ rime/kAbbreviation., |
| 19 | kCompletioncxx . . $ rime/kCompletion., |
| 20 | kAmbiguousSpellingcxx . . $ rime/kAmbiguousSpelling., |
| 21 | kInvalidSpellingcxx . . $ rime/kInvalidSpelling. |
| 22 | }; |
| 23 | |
| 24 | struct SpellingPropertiescxx . . $ rime/SpellingProperties# { |
| 25 | SpellingTypecxx . . $ rime/SpellingType# typecxx . . $ rime/SpellingProperties#type. = kNormalSpellingcxx . . $ rime/kNormalSpelling.; |
| 26 | size_t end_poscxx . . $ rime/SpellingProperties#end_pos. = 0; |
| 27 | double credibilitycxx . . $ rime/SpellingProperties#credibility. = 0.0; |
| 28 | stringcxx . . $ rime/string# tipscxx . . $ rime/SpellingProperties#tips.; |
| 29 | bool is_correctioncxx . . $ rime/SpellingProperties#is_correction. = false; |
| 30 | |
| 31 | // 疊加運算規則, 將運算規則產生的屬性應用到當前拼寫上 |
| 32 | void Composecxx . . $ rime/SpellingProperties#Compose(44a3e4de2f76d0b9).(const SpellingPropertiescxx . . $ rime/SpellingProperties#& delta); |
| 33 | // 更新優化拼寫, 將另一個候選拼寫合併到當前記錄 |
| 34 | void Updatecxx . . $ rime/SpellingProperties#Update(44a3e4de2f76d0b9).(const SpellingPropertiescxx . . $ rime/SpellingProperties#& other); |
| 35 | }; |
| 36 | |
| 37 | struct Spellingcxx . . $ rime/Spelling# { |
| 38 | stringcxx . . $ rime/string# strcxx . . $ rime/Spelling#str.; |
| 39 | SpellingPropertiescxx . . $ rime/SpellingProperties# propertiescxx . . $ rime/Spelling#properties.; |
| 40 | |
| 41 | Spellingcxx . . $ rime/Spelling#Spelling(49f6e7a06ebc5aa8).() = default; |
| 42 | Spellingcxx . . $ rime/Spelling#Spelling(9c546c94e5fcce4e).(const stringcxx . . $ rime/string#& _str) : strcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).(_str) {} |
| 43 | |
| 44 | bool operatorcxx . . $ rime/Spelling#`operator==`(93186466c5083d2a).==(const Spellingcxx . . $ rime/Spelling#& other) { return strcxx . . $ rime/Spelling#str. ==cxx . . $ std/`operator==`(5ea818b58063a774). other.strcxx . . $ rime/Spelling#str.; } |
| 45 | bool operatorcxx . . $ rime/Spelling#`operator<`(93186466c5083d2a).<(const Spellingcxx . . $ rime/Spelling#& other) { return strcxx . . $ rime/Spelling#str. <cxx . . $ std/`operator<`(5ea818b58063a774). other.strcxx . . $ rime/Spelling#str.; } |
| 46 | }; |
| 47 | |
| 48 | } // namespace rime |
| 49 | |
| 50 | #endif // RIME_SPELLING_H_ |