libime
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
libime::PinyinDictionary Class Reference

PinyinDictionary is a set of dictionaries for Pinyin. More...

#include <libime/pinyin/pinyindictionary.h>

Inheritance diagram for libime::PinyinDictionary:
Inheritance graph
[legend]
Collaboration diagram for libime::PinyinDictionary:
Collaboration graph
[legend]

Public Types

using dictionaryChanged = TrieDictionary::dictionaryChanged
 
- Public Types inherited from libime::TrieDictionary
using TrieType = DATrie< float >
 

Public Member Functions

void load (size_t idx, std::istream &in, PinyinDictFormat format)
 
void load (size_t idx, const char *filename, PinyinDictFormat format)
 
void matchWords (const char *data, size_t size, PinyinMatchCallback callback) const
 
void matchWordsPrefix (const char *data, size_t size, PinyinMatchCallback callback) const
 
void save (size_t idx, const char *filename, PinyinDictFormat format)
 
void save (size_t idx, std::ostream &out, PinyinDictFormat format)
 
void addWord (size_t idx, std::string_view fullPinyin, std::string_view hanzi, float cost=0.0F)
 
bool removeWord (size_t idx, std::string_view fullPinyin, std::string_view hanzi)
 
std::optional< float > lookupWord (size_t idx, std::string_view fullPinyin, std::string_view hanzi) const
 
void setFlags (size_t idx, PinyinDictFlags flags)
 
- Public Member Functions inherited from libime::TrieDictionary
void addEmptyDict ()
 
void removeAll ()
 
void removeFrom (size_t idx)
 Remove all dictionary from given index. More...
 
void clear (size_t idx)
 
const TrieTypetrie (size_t idx) const
 
void setTrie (size_t idx, TrieType trie)
 Set trie from external source. More...
 
size_t dictSize () const
 
 FCITX_DECLARE_SIGNAL (TrieDictionary, dictionaryChanged, void(size_t))
 
 FCITX_DECLARE_SIGNAL (TrieDictionary, dictSizeChanged, void(size_t))
 
- Public Member Functions inherited from libime::Dictionary
void matchPrefix (const SegmentGraph &graph, const GraphMatchCallback &callback, const std::unordered_set< const SegmentGraphNode *> &ignore={}, void *helper=nullptr) const
 

Static Public Member Functions

static TrieType load (std::istream &in, PinyinDictFormat format)
 Load text format into the Trie. More...
 

Protected Member Functions

void matchPrefixImpl (const SegmentGraph &graph, const GraphMatchCallback &callback, const std::unordered_set< const SegmentGraphNode *> &ignore, void *helper) const override
 
- Protected Member Functions inherited from libime::TrieDictionary
TrieTypemutableTrie (size_t idx)
 
void addWord (size_t idx, std::string_view key, float cost=0.0F)
 
bool removeWord (size_t idx, std::string_view key)
 
 FCITX_DECLARE_PRIVATE (TrieDictionary)
 

Additional Inherited Members

- Static Public Attributes inherited from libime::TrieDictionary
static const size_t SystemDict = 0
 
static const size_t UserDict = 1
 
- Protected Attributes inherited from libime::TrieDictionary
std::unique_ptr< TrieDictionaryPrivated_ptr
 

Detailed Description

PinyinDictionary is a set of dictionaries for Pinyin.

Definition at line 56 of file pinyindictionary.h.

Member Function Documentation

◆ load()

PinyinDictionary::TrieType libime::PinyinDictionary::load ( std::istream &  in,
PinyinDictFormat  format 
)
static

Load text format into the Trie.

Parameters
ininput stream
formatdict format.
See also
TrieDictionary::setTrie
Since
1.1.7

Definition at line 851 of file pinyindictionary.cpp.


The documentation for this class was generated from the following files: