|
libime
|


Public Member Functions | |
| PinyinContext (PinyinIME *ime) | |
| void | setUseShuangpin (bool sp) |
| bool | useShuangpin () const |
| void | erase (size_t from, size_t to) override |
| void | setCursor (size_t pos) override |
| int | maxSentenceLength () const |
| void | setMaxSentenceLength (int length) |
| const std::vector< SentenceResult > & | candidates () const |
| const std::unordered_set< std::string > & | candidateSet () const |
| Return the set of candidates, useful for deduplication. More... | |
| const std::vector< SentenceResult > & | candidatesToCursor () const |
| const std::unordered_set< std::string > & | candidatesToCursorSet () const |
| Return the set of candidates to current cursor. More... | |
| void | select (size_t idx) |
| void | selectCandidatesToCursor (size_t idx) |
| void | cancel () |
| bool | cancelTill (size_t pos) |
| void | selectCustom (size_t inputLength, std::string_view segment, std::string_view encodedPinyin="") |
| Create a custom selection. More... | |
| bool | selected () const |
| Whether the input is fully selected. | |
| std::string | sentence () const |
| The sentence for this context, can be used as preedit. | |
| std::string | preedit (PinyinPreeditMode mode) const |
| std::pair< std::string, size_t > | preeditWithCursor (PinyinPreeditMode mode) const |
| Mixed preedit (selected hanzi + pinyin). | |
| std::string | preedit () const |
| std::pair< std::string, size_t > | preeditWithCursor () const |
| Mixed preedit (selected hanzi + pinyin). | |
| std::string | selectedSentence () const |
| Selected hanzi. | |
| size_t | selectedLength () const |
| Selected pinyin length. | |
| std::vector< std::string > | selectedWords () const |
| Selected hanzi segments. | |
| std::vector< HistoryBigram::WordWithCode > | selectedWordsWithPinyin () const |
| Selected hanzi with encoded pinyin. | |
| std::string | selectedFullPinyin () const |
| Get the full pinyin string of the selected part. | |
| std::string | candidateFullPinyin (size_t i) const |
| Get the full pinyin string of certain candidate. | |
| std::string | candidateFullPinyin (const SentenceResult &candidate) const |
| Get the full pinyin string of certain candidate. | |
| void | learn () |
| Add the selected part to history if selected() == true. | |
| int | pinyinBeforeCursor () const |
| Return the position of last pinyin. More... | |
| int | pinyinAfterCursor () const |
| Return the position of last pinyin. More... | |
| PinyinIME * | ime () const |
| State | state () const |
| Opaque language model state. | |
| void | setContextWords (const std::vector< std::string > &contextWords) |
| Set context words for better prediction. More... | |
| void | clearContextWords () |
| Clear context words. More... | |
| void | appendContextWords (const std::vector< std::string > &contextWords) |
| Append context words for better prediction. More... | |
| std::vector< std::string > | contextWords () const |
| Get context words for better prediction. More... | |
| void | setContextWordsWithPinyin (const std::vector< HistoryBigram::WordWithCode > &contextWordsWithPinyin) |
| Set context words with pinyin for better prediction. More... | |
| void | appendContextWordsWithPinyin (const std::vector< HistoryBigram::WordWithCode > &contextWordsWithPinyin) |
| Append context words with pinyin for better prediction. More... | |
| std::vector< HistoryBigram::WordWithCode > | contextWordsWithPinyin () const |
| Get context words with pinyin for better prediction. More... | |
Public Member Functions inherited from libime::InputBuffer | |
| bool | type (std::string_view s) |
| std::string_view | at (size_t i) const |
| std::string_view | operator[] (size_t i) const |
| iterator | begin () |
| iterator | end () |
Protected Member Functions | |
| bool | typeImpl (const char *s, size_t length) override |
Definition at line 29 of file pinyincontext.h.
| void libime::PinyinContext::appendContextWords | ( | const std::vector< std::string > & | contextWords | ) |
Append context words for better prediction.
| contextWords | The context words. |
Definition at line 1053 of file pinyincontext.cpp.
| void libime::PinyinContext::appendContextWordsWithPinyin | ( | const std::vector< HistoryBigram::WordWithCode > & | contextWordsWithPinyin | ) |
Append context words with pinyin for better prediction.
| contextWordsWithPinyin | The context words with pinyin. |
Definition at line 1086 of file pinyincontext.cpp.
| const std::unordered_set< std::string > & libime::PinyinContext::candidateSet | ( | ) | const |
Return the set of candidates, useful for deduplication.
Definition at line 507 of file pinyincontext.cpp.
| const std::unordered_set< std::string > & libime::PinyinContext::candidatesToCursorSet | ( | ) | const |
Return the set of candidates to current cursor.
Definition at line 522 of file pinyincontext.cpp.
| void libime::PinyinContext::clearContextWords | ( | ) |
| std::vector< std::string > libime::PinyinContext::contextWords | ( | ) | const |
Get context words for better prediction.
Definition at line 1069 of file pinyincontext.cpp.
| std::vector< HistoryBigram::WordWithCode > libime::PinyinContext::contextWordsWithPinyin | ( | ) | const |
Get context words with pinyin for better prediction.
Definition at line 1103 of file pinyincontext.cpp.
| int libime::PinyinContext::pinyinAfterCursor | ( | ) | const |
Return the position of last pinyin.
E.g. 你h|ao, return the offset after h.
Definition at line 479 of file pinyincontext.cpp.
| int libime::PinyinContext::pinyinBeforeCursor | ( | ) | const |
Return the position of last pinyin.
E.g. 你h|ao, return the offset before h.
Definition at line 455 of file pinyincontext.cpp.
| void libime::PinyinContext::selectCustom | ( | size_t | inputLength, |
| std::string_view | segment, | ||
| std::string_view | encodedPinyin = "" |
||
| ) |
Create a custom selection.
This allows Engine to do make a custom selection that is not pinyin.
| inputLength | the length of characters to match in the input |
| segment | segment |
| encodedPinyin | whether this segment has a pinyin |
Definition at line 545 of file pinyincontext.cpp.
| void libime::PinyinContext::setContextWords | ( | const std::vector< std::string > & | contextWords | ) |
Set context words for better prediction.
| contextWords | The context words. |
Definition at line 1041 of file pinyincontext.cpp.
| void libime::PinyinContext::setContextWordsWithPinyin | ( | const std::vector< HistoryBigram::WordWithCode > & | contextWordsWithPinyin | ) |
Set context words with pinyin for better prediction.
| contextWordsWithPinyin | The context words with encoded pinyin. |
Definition at line 1079 of file pinyincontext.cpp.
1.8.13