Open Chinese Convert: opencc::DartsDict Class Reference

Open Chinese Convert 1.1.1 A project for conversion between Traditional and Simplified Chinese

Public Member Functions | Static Public Member Functions | List of all members
opencc::DartsDict Class Reference
OpenCC C++ Comprehensive API

Darts dictionary. More...

`#include <DartsDict.hpp>`

Inheritance diagram for opencc::DartsDict:

## Public Member Functions
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 Optional< const DictEntry * > | MatchPrefix (const char *word, size_t len) const
| Matches the longest matched prefix of a word. More...
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().
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).
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 DartsDictPtr | NewFromDict (const Dict &thatDict)
| Constructs a DartsDict from another dictionary.
static DartsDictPtr | NewFromFile (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

Darts dictionary.

## Member Function Documentation

## ◆ MatchPrefix()

Optional< const DictEntry * > DartsDict::MatchPrefix | ( | const char * | word,
|  | size_t | len
| ) |  | const
| 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.

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

- DartsDict.hpp
- DartsDict.cpp