librime: contextual_translation.h Source File

| librime 1.2 Rime Input Method Engine, the core library

contextual_translation.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5
6#include <rime/common.h>
7#include <rime/translation.h>
8
9namespace rime {
10
11class Candidate;
12class Grammar;
13class Phrase;
14
15 class ContextualTranslation : public PrefetchTranslation {
16 public:
17 ContextualTranslation(an<Translation> translation,
18 string input,
19 string preceding_text,
20 Grammar* grammar)
21 : PrefetchTranslation(translation),
22 input_(input),
23 preceding_text_(preceding_text),
24 grammar_(grammar) {}
25
26 protected:
27 bool Replenish() override;
28
29 private:
30 an<Phrase> Evaluate(an<Phrase> phrase);
31 void AppendToCache(vector<of<Phrase>>& queue);
32
33 string input_;
34 string preceding_text_;
35 Grammar* grammar_;
36};
37
38} // namespace rime
common.h
translation.h
rime
Definition algebra.cc:12
rime::an
std::shared_ptr< T > an
Definition common.h:60
rime::of
an< T > of
Definition common.h:62
rime::Candidate
Definition candidate.h:14
rime::ContextualTranslation::ContextualTranslation
ContextualTranslation(an< Translation > translation, string input, string preceding_text, Grammar *grammar)
Definition contextual_translation.h:17
rime::ContextualTranslation::Replenish
bool Replenish() override
Definition contextual_translation.cc:11
rime::Grammar
Definition grammar.h:11
rime::Phrase
Definition translator_commons.h:63
rime::PrefetchTranslation::PrefetchTranslation
PrefetchTranslation(an< Translation > translation)
Definition translation.cc:211