summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi Sumita <hsumita@google.com>2012-03-07 12:52:59 +0900
committerHiroshi Sumita <hsumita@google.com>2012-03-07 12:52:59 +0900
commit228c946461e19f53f136ca8325edf6c53225cbca (patch)
tree9b898ff84966248c8d90eacb3ea1103c58f9c489
parenta4eb9289335d7c51d62596e212ab795ba12b7955 (diff)
downloadpyzy-228c946461e19f53f136ca8325edf6c53225cbca.tar.gz
Apply SimpTradConverter to candidates and fix bugs
BUG=Candidates text are always simplified chinese characters. TEST=Manually tested with client code. Review URL: https://codereview.appspot.com/5752053
-rw-r--r--src/PyZyPhoneticContext.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/PyZyPhoneticContext.cc b/src/PyZyPhoneticContext.cc
index 427e319..543db97 100644
--- a/src/PyZyPhoneticContext.cc
+++ b/src/PyZyPhoneticContext.cc
@@ -91,16 +91,20 @@ PhoneticContext::updateLookupTable (void)
for (size_t i = 0; i < phrase_array.size (); ++i) {
CandidateType candidate_type;
- if (i < m_special_phrases.size ()) {
- candidate_type = SPECIAL_PHRASE;
- } else if (m_phrase_editor.candidateIsUserPhrase (i - m_special_phrases.size ())) {
+ if (m_phrase_editor.candidateIsUserPhrase (i)) {
candidate_type = USER_PHRASE;
} else {
candidate_type = NORMAL_PHRASE;
}
Candidate candidate;
- candidate.text = phrase_array[i].phrase;
+ if (G_LIKELY (m_config.modeSimp())) {
+ candidate.text = phrase_array[i].phrase;
+ } else {
+ String traditional_text;
+ SimpTradConverter::simpToTrad(phrase_array[i].phrase, traditional_text);
+ candidate.text = traditional_text;
+ }
candidate.type = candidate_type;
m_candidates.push_back (candidate);
}