Open Chinese Convert
1.1.7
A project for conversion between Traditional and Simplified Chinese
|
22 #include "DictEntry.hpp"
35 size_t len)
const = 0;
41 return Match(word.c_str(), word.length());
56 return MatchPrefix(word, KeyMaxLength());
63 return MatchPrefix(word.c_str(), word.length());
71 virtual std::vector<const DictEntry*> MatchAllPrefixes(
const char* word,
77 std::vector<const DictEntry*>
79 return MatchAllPrefixes(word.c_str(), word.length());
85 virtual size_t KeyMaxLength()
const = 0;
90 virtual LexiconPtr GetLexicon()
const = 0;
Optional< const DictEntry * > MatchPrefix(const char *word) const
Matches the longest matched prefix of a word.
Definition: Dict.hpp:55
Abstract class of dictionary.
Definition: Dict.hpp:29
std::vector< const DictEntry * > MatchAllPrefixes(const std::string &word) const
Returns all matched prefixes of a word, sorted by the length (desc).
Definition: Dict.hpp:78
Optional< const DictEntry * > MatchPrefix(const std::string &word) const
Matches the longest matched prefix of a word.
Definition: Dict.hpp:62
Optional< const DictEntry * > Match(const std::string &word) const
Matches a word exactly and returns the DictEntry or Optional::Null().
Definition: Dict.hpp:40
A class that wraps type T into a nullable type.
Definition: Optional.hpp:26