Open Chinese Convert
1.0.2
A project for conversion between Traditional and Simplified Chinese
|
Text dictionary. More...
#include <TextDict.hpp>
Public Member Functions | |
TextDict (const LexiconPtr &_lexicon) | |
Constructor of TextDict. More... | |
virtual size_t | KeyMaxLength () const |
Returns the length of the longest key in the dictionary. | |
virtual Optional< const DictEntry * > | Match (const char *word) const |
Matches a word exactly and returns the DictEntry or Optional::Null(). | |
virtual LexiconPtr | GetLexicon () const |
Returns all entries in the dictionary. | |
virtual void | SerializeToFile (FILE *fp) const |
Serializes the dictionary and writes in to a file. | |
Public Member Functions inherited from opencc::Dict | |
Optional< const DictEntry * > | Match (const string &word) const |
Matches a word exactly and returns the DictEntry or Optional::Null(). | |
virtual Optional< const DictEntry * > | MatchPrefix (const char *word) const |
Matches the longest matched prefix of a word. More... | |
Optional< const DictEntry * > | MatchPrefix (const string &word) const |
Matches the longest matched prefix of a word. | |
virtual vector< const DictEntry * > | MatchAllPrefixes (const char *word) const |
Returns all matched prefixes of a word, sorted by the length (desc). More... | |
vector< const DictEntry * > | MatchAllPrefixes (const string &word) const |
Returns all matched prefixes of a word, sorted by the length (desc). | |
Public Member Functions inherited from opencc::SerializableDict | |
virtual void | SerializeToFile (const string &fileName) const |
Serializes the dictionary and writes in to a file. | |
Static Public Member Functions | |
static TextDictPtr | NewFromDict (const Dict &dict) |
Constructs a TextDict from another dictionary. | |
static TextDictPtr | NewFromFile (FILE *fp) |
static TextDictPtr | NewFromSortedFile (FILE *fp) |
Static Public Member Functions inherited from opencc::SerializableDict | |
template<typename DICT > | |
static bool | TryLoadFromFile (const string &fileName, std::shared_ptr< DICT > *dict) |
template<typename DICT > | |
static std::shared_ptr< DICT > | NewFromFile (const string &fileName) |
Text dictionary.
TextDict::TextDict | ( | const LexiconPtr & | _lexicon | ) |
Constructor of TextDict.
_lexicon must be sorted.