[dasher] GC DasherInterfaceBase::WriteTrainFilePartial, strCurrentContext
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] GC DasherInterfaceBase::WriteTrainFilePartial, strCurrentContext
- Date: Tue, 18 Jan 2011 17:16:50 +0000 (UTC)
commit d9117f4be5daf7b58fb4096b11993601061ab124
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Wed Nov 24 13:25:08 2010 +0000
GC DasherInterfaceBase::WriteTrainFilePartial, strCurrentContext
Src/DasherCore/DasherInterfaceBase.cpp | 66 --------------------------------
Src/DasherCore/DasherInterfaceBase.h | 3 +-
Src/DasherCore/DasherModel.cpp | 4 ++
3 files changed, 5 insertions(+), 68 deletions(-)
---
diff --git a/Src/DasherCore/DasherInterfaceBase.cpp b/Src/DasherCore/DasherInterfaceBase.cpp
index ff7fe98..3dd3d72 100644
--- a/Src/DasherCore/DasherInterfaceBase.cpp
+++ b/Src/DasherCore/DasherInterfaceBase.cpp
@@ -105,8 +105,6 @@ CDasherInterfaceBase::CDasherInterfaceBase() {
// m_bGlobalLock = false;
- // TODO: Are these actually needed?
- strCurrentContext = ". ";
strTrainfileBuffer = "";
m_strCurrentWord = "";
@@ -341,9 +339,6 @@ void CDasherInterfaceBase::InterfaceEventHandler(Dasher::CEvent *pEvent) {
CEditEvent *pEditEvent(static_cast < CEditEvent * >(pEvent));
if(pEditEvent->m_iEditType == 1) {
- strCurrentContext += pEditEvent->m_sText;
- if( strCurrentContext.size() > 20 )
- strCurrentContext = strCurrentContext.substr( strCurrentContext.size() - 20 );
if(GetBoolParameter(BP_LM_ADAPTIVE))
strTrainfileBuffer += pEditEvent->m_sText;
if (GetBoolParameter(BP_SPEAK_WORDS) && SupportsSpeech()) {
@@ -356,7 +351,6 @@ void CDasherInterfaceBase::InterfaceEventHandler(Dasher::CEvent *pEvent) {
}
}
else if(pEditEvent->m_iEditType == 2) {
- strCurrentContext = strCurrentContext.substr( 0, strCurrentContext.size() - pEditEvent->m_sText.size());
if(GetBoolParameter(BP_LM_ADAPTIVE))
strTrainfileBuffer = strTrainfileBuffer.substr( 0, strTrainfileBuffer.size() - pEditEvent->m_sText.size());
if (GetBoolParameter(BP_SPEAK_WORDS))
@@ -370,12 +364,6 @@ void CDasherInterfaceBase::WriteTrainFileFull() {
strTrainfileBuffer = "";
}
-void CDasherInterfaceBase::WriteTrainFilePartial() {
- // TODO: what if we're midway through a unicode character?
- WriteTrainFile(strTrainfileBuffer.substr(0,100));
- strTrainfileBuffer = strTrainfileBuffer.substr(100);
-}
-
void CDasherInterfaceBase::CreateNCManager() {
if(!m_AlphIO || GetLongParameter(LP_LANGUAGE_MODEL_ID)==-1)
@@ -708,59 +696,6 @@ void CDasherInterfaceBase::ResetNats() {
m_pDasherModel->ResetNats();
}
-
-// TODO: Check that none of this needs to be reimplemented
-
-// void CDasherInterfaceBase::InvalidateContext(bool bForceStart) {
-// m_pDasherModel->m_strContextBuffer = "";
-
-// Dasher::CEditContextEvent oEvent(10);
-// m_pEventHandler->InsertEvent(&oEvent);
-
-// std::string strNewContext(m_pDasherModel->m_strContextBuffer);
-
-// // We keep track of an internal context and compare that to what
-// // we are given - don't restart Dasher if nothing has changed.
-// // This should really be integrated with DasherModel, which
-// // probably will be the case when we start to deal with being able
-// // to back off indefinitely. For now though we'll keep it in a
-// // separate string.
-
-// int iContextLength( 6 ); // The 'important' context length - should really get from language model
-
-// // FIXME - use unicode lengths
-
-// if(bForceStart || (strNewContext.substr( std::max(static_cast<int>(strNewContext.size()) - iContextLength, 0)) != strCurrentContext.substr( std::max(static_cast<int>(strCurrentContext.size()) - iContextLength, 0)))) {
-
-// if(m_pDasherModel != NULL) {
-// // TODO: Reimplement this
-// // if(m_pDasherModel->m_bContextSensitive || bForceStart) {
-// {
-// m_pDasherModel->SetContext(strNewContext);
-// PauseAt(0,0);
-// }
-// }
-
-// strCurrentContext = strNewContext;
-// WriteTrainFileFull();
-// }
-
-// if(bForceStart) {
-// int iMinWidth;
-
-// if(m_pInputFilter && m_pInputFilter->GetMinWidth(iMinWidth)) {
-// m_pDasherModel->LimitRoot(iMinWidth);
-// }
-// }
-
-// if(m_pDasherView)
-// while( m_pDasherModel->CheckForNewRoot(m_pDasherView) ) {
-// // Do nothing
-// }
-
-// ScheduleRedraw();
-// }
-
// TODO: Fix this
std::string CDasherInterfaceBase::GetContext(int iStart, int iLength) {
@@ -774,7 +709,6 @@ std::string CDasherInterfaceBase::GetContext(int iStart, int iLength) {
void CDasherInterfaceBase::ClearAllContext() {
SetBuffer(0);
- strCurrentContext = "";
}
void CDasherInterfaceBase::SetContext(std::string strNewContext) {
diff --git a/Src/DasherCore/DasherInterfaceBase.h b/Src/DasherCore/DasherInterfaceBase.h
index 85cb161..53ee436 100644
--- a/Src/DasherCore/DasherInterfaceBase.h
+++ b/Src/DasherCore/DasherInterfaceBase.h
@@ -564,7 +564,6 @@ protected:
bool DrawActionButtons();
void WriteTrainFileFull();
- void WriteTrainFilePartial();
std::deque<std::string> m_deGameModeStrings;
@@ -587,8 +586,8 @@ protected:
CUserLogBase *m_pUserLog;
/// @}
+ ///TODO this is in the wrong place. DashIntf should not be managing the training file...
std::string strTrainfileBuffer;
- std::string strCurrentContext;
///builds up the word currently being entered for speech.
std::string m_strCurrentWord;
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index 3dc20db..9e030ea 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -262,6 +262,10 @@ void CDasherModel::SetOffset(int iOffset, CAlphabetManager *pMgr, CDasherView *p
double dFraction( 1 - (1 - m_Root->MostProbableChild() / static_cast<double>(GetLongParameter(LP_NORMALIZATION))) / 2.0 );
+ //TODO somewhere round here, old code checked whether the InputFilter implemented
+ // GetMinWidth, if so called LimitRoot w/that width - i.e., make sure iWidth
+ // is no more than that minimum. Should we do something similar here???
+
int iWidth( static_cast<int>( (GetLongParameter(LP_MAX_Y) / (2.0*dFraction)) ) );
m_Rootmin = GetLongParameter(LP_MAX_Y) / 2 - iWidth / 2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]