librime: rime::EditDistanceCorrector Class Reference

| librime 1.2 Rime Input Method Engine, the core library

Public Member Functions | List of all members
rime::EditDistanceCorrector Class Reference

`#include <corrector.h>`

Inheritance diagram for rime::EditDistanceCorrector:
[legend]
Collaboration diagram for rime::EditDistanceCorrector:
[legend]

## Public Member Functions
| ~EditDistanceCorrector () override=default
RIME_DLL | EditDistanceCorrector (const path &file_path)
RIME_DLL bool | Build (const Syllabary &syllabary, const Script *script=nullptr, uint32_t dict_file_checksum=0, uint32_t schema_file_checksum=0)
RIME_DLL void | ToleranceSearch (const Prism &prism, const string &key, corrector::Corrections *results, size_t tolerance) override
corrector::Distance | LevenshteinDistance (const std::string &s1, const std::string &s2)
corrector::Distance | RestrictedDistance (const std::string &s1, const std::string &s2, corrector::Distance threshold)
Public Member Functions inherited from rime::Corrector
virtual | ~Corrector ()=default
Public Member Functions inherited from rime::Prism
RIME_DLL | Prism (const path &file_path)
RIME_DLL bool | Load ()
RIME_DLL bool | Save ()
RIME_DLL bool | Build (const Syllabary &syllabary, const Script *script=nullptr, uint32_t dict_file_checksum=0, uint32_t schema_file_checksum=0)
RIME_DLL bool | HasKey (const string &key)
RIME_DLL bool | GetValue (const string &key, int *value) const
RIME_DLL void | CommonPrefixSearch (const string &key, vector< Match > *result)
RIME_DLL void | ExpandSearch (const string &key, vector< Match > *result, size_t limit)
SpellingAccessor | QuerySpelling (SyllableId spelling_id)
RIME_DLL size_t | array_size () const
uint32_t | dict_file_checksum () const
uint32_t | schema_file_checksum () const
Darts::DoubleArray & | trie () const
Public Member Functions inherited from rime::MappedFile
| MappedFile (const MappedFile &)=delete
MappedFile & | operator= (const MappedFile &)=delete
bool | Exists () const
bool | IsOpen () const
void | Close ()
bool | Remove ()
template<class T>
T * | Find (size_t offset)
const path & | file_path () const
size_t | file_size () const

## Additional Inherited Members
Public Types inherited from rime::Class< Corrector, const Ticket & >
using | Initializer
Public Types inherited from rime::Prism
using | Match = Darts::DoubleArray::result_pair_type
Static Public Member Functions inherited from rime::Class< Corrector, const Ticket & >
static Component * | Require (const string &name)
Protected Member Functions inherited from rime::MappedFile
| MappedFile (const path &file_path)
virtual | ~MappedFile ()
bool | Create (size_t capacity)
bool | OpenReadOnly ()
bool | OpenReadWrite ()
bool | Flush ()
bool | Resize (size_t capacity)
bool | ShrinkToFit ()
template<class T>
T * | Allocate (size_t count=1)
template<class T>
Array< T > * | CreateArray (size_t array_size)
String * | CreateString (const string &str)
bool | CopyString (const string &src, String *dest)
size_t | capacity () const
char * | address () const
Protected Attributes inherited from rime::Prism
the< Darts::DoubleArray > | trie_
prism::Metadata * | metadata_ = nullptr
prism::SpellingMap * | spelling_map_ = nullptr
double | format_ = 0.0

## Constructor & Destructor Documentation

## ◆ ~EditDistanceCorrector()

rime::EditDistanceCorrector::~EditDistanceCorrector | ( |  | ) |
| overridedefault

## ◆ EditDistanceCorrector()

EditDistanceCorrector::EditDistanceCorrector | ( | const path & | file_path | ) |
| explicit

## Member Function Documentation

## ◆ Build()

bool EditDistanceCorrector::Build | ( | const Syllabary & | syllabary,
|  | const Script * | script = nullptr,
|  | uint32_t | dict_file_checksum = 0,
|  | uint32_t | schema_file_checksum = 0 )

## ◆ LevenshteinDistance()

Distance EditDistanceCorrector::LevenshteinDistance | ( | const std::string & | s1,
|  | const std::string & | s2 )

## ◆ RestrictedDistance()

Distance EditDistanceCorrector::RestrictedDistance | ( | const std::string & | s1,
|  | const std::string & | s2,
|  | corrector::Distance | threshold )

## ◆ ToleranceSearch()

void EditDistanceCorrector::ToleranceSearch | ( | const Prism & | prism,
|  | const string & | key,
|  | corrector::Corrections * | results,
|  | size_t | tolerance )
| overridevirtual

Implements rime::Corrector.

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

- corrector.h
- corrector.cc