diff --git a/honoka/src/honoka_imengine.cpp b/honoka/src/honoka_imengine.cpp index 1915ac4..a8d8d2a 100644 --- a/honoka/src/honoka_imengine.cpp +++ b/honoka/src/honoka_imengine.cpp @@ -655,8 +655,12 @@ if (k_commit.comp(key)) { if (auto_conversion) { commit_string(m_convertor->getText()); + if (m_predictor->isConnected()) m_predictor->update(m_convertor->getText()); m_convertor->reset(); - } else commit_string(m_preeditor->getText(true)); + } else { + commit_string(m_preeditor->getText(true)); + if (m_predictor->isConnected()) m_predictor->update(m_preeditor->getText(true)); + } m_preeditor->reset(); while(preeditStack.size()) { preeditStack.pop(); @@ -810,6 +814,7 @@ preeditStack.pop(); } m_convertor->updateFrequency(); + if (m_predictor->isConnected()) m_predictor->update(m_convertor->getText()); m_preeditor->reset(); m_convertor->reset(); m_conversion = false; @@ -969,6 +974,7 @@ */ commit_string(m_convertor->getText()); m_convertor->updateFrequency(); + if (m_predictor->isConnected()) m_predictor->update(m_convertor->getText()); m_preeditor->reset(); m_convertor->reset(); m_conversion = false; @@ -1156,6 +1162,7 @@ if (m_conversion) { commit_string(m_convertor->getText()); m_convertor->updateFrequency(); + if (m_predictor->isConnected()) m_predictor->update(m_convertor->getText()); m_convertor->reset(); if (m_def_convertor != m_convertor) m_convertor = m_def_convertor; m_conversion = false; diff --git a/honoka/src/predictor.cpp b/honoka/src/predictor.cpp index d06d28f..bf1b0d3 100644 --- a/honoka/src/predictor.cpp +++ b/honoka/src/predictor.cpp @@ -84,3 +84,12 @@ return String("Predicter"); } + + +/*! + \fn Predictor::update(const WideString str) + */ +void Predictor::update(const WideString str) +{ + return; +} diff --git a/honoka/src/predictor.h b/honoka/src/predictor.h index c290aed..c221aea 100644 --- a/honoka/src/predictor.h +++ b/honoka/src/predictor.h @@ -52,6 +52,7 @@ virtual bool isConnected(); virtual String getPropertyName(); virtual String getName(); + virtual void update(const WideString str); }; #endif diff --git a/honoka/src/wnnconversion.cpp b/honoka/src/wnnconversion.cpp index 22a2098..bb5f000 100644 --- a/honoka/src/wnnconversion.cpp +++ b/honoka/src/wnnconversion.cpp @@ -489,6 +489,7 @@ jl_yosoku_toroku(wnn,ws,c); #endif jl_optimize_fi(wnn,0,-1); + pretext = getText(); } } @@ -513,3 +514,22 @@ return String("Wnn"); } + + +/*! + \fn WnnConversion::updateYosoku(WideString text) + */ +void WnnConversion::updateYosoku(WideString text) +{ + #ifdef HAVE_LIBWNN7 + if (text == pretext) return; + w_char ws[1024]; + char c[2048]; + String y; + m_iconv.convert(y,text); + strtows(ws,(unsigned char*)y.c_str()); + jl_yosoku_toroku(wnn,ws,text.length()); + #endif + return; + +} diff --git a/honoka/src/wnnconversion.h b/honoka/src/wnnconversion.h index aaf74dd..671bd80 100644 --- a/honoka/src/wnnconversion.h +++ b/honoka/src/wnnconversion.h @@ -75,6 +75,7 @@ virtual int getCaretPos(); virtual String getName(); virtual String getPropertyName(); + void updateYosoku(WideString text); protected: @@ -102,6 +103,7 @@ vector yomiList; AttributeList attr; ResultList convList; + WideString pretext; }; diff --git a/honoka/src/wnnprediction.cpp b/honoka/src/wnnprediction.cpp index 62feb00..3368946 100644 --- a/honoka/src/wnnprediction.cpp +++ b/honoka/src/wnnprediction.cpp @@ -98,4 +98,12 @@ return String(_("WnnPrediction")); } +/*! + \fn WnnPrediction::update(const WideString str) + */ +void WnnPrediction::update(const WideString str) +{ + //convertor->updateYosoku(str); + return; +} diff --git a/honoka/src/wnnprediction.h b/honoka/src/wnnprediction.h index a316639..d161ba2 100644 --- a/honoka/src/wnnprediction.h +++ b/honoka/src/wnnprediction.h @@ -48,6 +48,7 @@ virtual bool isConnected(); virtual String getPropertyName(); virtual String getName(); + virtual void update(const WideString str); protected: WnnConversion *convertor;