Open Chinese Convert 1.1.5
A project for conversion between Traditional and Simplified Chinese
|
Darts dictionary. More...
#include <MarisaDict.hpp>
Public Member Functions | |
virtual size_t | KeyMaxLength () const |
Returns the length of the longest key in the dictionary. More... | |
virtual Optional< const DictEntry * > | Match (const char *word, size_t len) const |
Matches a word exactly and returns the DictEntry or Optional::Null(). More... | |
virtual Optional< const DictEntry * > | MatchPrefix (const char *word, size_t len) const |
Matches the longest matched prefix of a word. More... | |
virtual std::vector< const DictEntry * > | MatchAllPrefixes (const char *word, size_t len) const |
Returns all matched prefixes of a word, sorted by the length (desc). More... | |
virtual LexiconPtr | GetLexicon () const |
Returns all entries in the dictionary. More... | |
virtual void | SerializeToFile (FILE *fp) const |
Serializes the dictionary and writes in to a file. More... | |
![]() | |
virtual Optional< const DictEntry * > | Match (const char *word, size_t len) const =0 |
Matches a word exactly and returns the DictEntry or Optional::Null(). More... | |
Optional< const DictEntry * > | Match (const std::string &word) const |
Matches a word exactly and returns the DictEntry or Optional::Null(). | |
virtual Optional< const DictEntry * > | MatchPrefix (const char *word, size_t len) const |
Matches the longest matched prefix of a word. More... | |
Optional< const DictEntry * > | MatchPrefix (const char *word) const |
Matches the longest matched prefix of a word. | |
Optional< const DictEntry * > | MatchPrefix (const std::string &word) const |
Matches the longest matched prefix of a word. | |
virtual std::vector< const DictEntry * > | MatchAllPrefixes (const char *word, size_t len) const |
Returns all matched prefixes of a word, sorted by the length (desc). More... | |
std::vector< const DictEntry * > | MatchAllPrefixes (const std::string &word) const |
Returns all matched prefixes of a word, sorted by the length (desc). | |
virtual size_t | KeyMaxLength () const =0 |
Returns the length of the longest key in the dictionary. More... | |
virtual LexiconPtr | GetLexicon () const =0 |
Returns all entries in the dictionary. More... | |
![]() | |
virtual void | SerializeToFile (FILE *fp) const =0 |
Serializes the dictionary and writes in to a file. More... | |
virtual void | SerializeToFile (const std::string &fileName) const |
Serializes the dictionary and writes in to a file. | |
Static Public Member Functions | |
static MarisaDictPtr | NewFromDict (const Dict &thatDict) |
Constructs a MarisaDict from another dictionary. | |
static MarisaDictPtr | NewFromFile (FILE *fp) |
![]() | |
template<typename DICT > | |
static bool | TryLoadFromFile (const std::string &fileName, std::shared_ptr< DICT > *dict) |
template<typename DICT > | |
static std::shared_ptr< DICT > | NewFromFile (const std::string &fileName) |
Darts dictionary.
|
virtual |
Returns all entries in the dictionary.
Implements opencc::Dict.
|
virtual |
Returns the length of the longest key in the dictionary.
Implements opencc::Dict.
Matches a word exactly and returns the DictEntry or Optional::Null().
Implements opencc::Dict.
|
virtual |
Returns all matched prefixes of a word, sorted by the length (desc).
For example given a dictionary having "a", "an", "b", "ba", "ban", "bana", all the matched prefixes of "banana" are "bana", "ban", "ba", "b".
Reimplemented from opencc::Dict.
|
virtual |
Matches the longest matched prefix of a word.
For example given a dictionary having "a", "an", "b", "ba", "ban", "bana", the longest prefix of "banana" matched is "bana".
Reimplemented from opencc::Dict.
|
virtual |
Serializes the dictionary and writes in to a file.
Implements opencc::SerializableDict.