Loading...
Searching...
No Matches
opencc::TextDict Class Reference
OpenCC C++ Comprehensive API

Text dictionary. More...

`#include <TextDict.hpp>`

Inheritance diagram for opencc::TextDict:

## Public Member Functions

| TextDict (const LexiconPtr &_lexicon)
| Constructor of TextDict.
virtual size_t | KeyMaxLength () const
| Returns the length of the longest key in the dictionary.
virtual Optional< const DictEntry * > | Match (const char *word, size_t len) 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 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.
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).
std::vector< const DictEntry * > | MatchAllPrefixes (const std::string &word) const
| Returns all matched prefixes of a word, sorted by the length (desc).
virtual const std::list< DictPtr > * | GetDictGroupItems () const
| Returns child dictionaries when this dictionary is a group.
Public Member Functions inherited from opencc::SerializableDict
virtual void | SerializeToFile (const std::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 std::string &fileName, std::shared_ptr< DICT > *dict)
template<typename DICT>
static std::shared_ptr< DICT > | NewFromFile (const std::string &fileName)

## Detailed Description

Text dictionary.

## Constructor & Destructor Documentation

## TextDict()

TextDict::TextDict | ( | const LexiconPtr & | _lexicon | ) |

Constructor of TextDict.

_lexicon must be sorted.

## Member Function Documentation

## GetLexicon()

LexiconPtr TextDict::GetLexicon | ( |  | ) | const

virtual

Returns all entries in the dictionary.

Implements opencc::Dict.

## KeyMaxLength()

size_t TextDict::KeyMaxLength | ( |  | ) | const

virtual

Returns the length of the longest key in the dictionary.

Implements opencc::Dict.

## Match()

Optional< const DictEntry * > TextDict::Match | ( | const char * | word,
|  | size_t | len ) const

virtual

Matches a word exactly and returns the DictEntry or Optional::Null().

Implements opencc::Dict.

## SerializeToFile()

void TextDict::SerializeToFile | ( | FILE * | fp | ) | const

virtual

Serializes the dictionary and writes in to a file.

Implements opencc::SerializableDict.

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

- TextDict.hpp
- TextDict.cpp