[dasher] Removed LanguageModel pointer from CAlphNode - can always obtain from Manager



commit 0c3538e8ba8a42bde975c87f9b78f17e14ee3373
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Mon Nov 23 20:58:37 2009 +0000

    Removed LanguageModel pointer from CAlphNode - can always obtain from Manager
    
    The potential for different nodes to have different language models is not yet
    used/exploited; so when we do do this :-), we can do it by having multiple
    CAlphabetManager instances instead.

 Src/DasherCore/AlphabetManager.cpp |   12 +++---------
 Src/DasherCore/AlphabetManager.h   |    1 -
 Src/DasherCore/MandarinAlphMgr.cpp |    1 -
 3 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index 7ea26ff..a6c4303 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -101,8 +101,6 @@ CAlphabetManager::CAlphNode *CAlphabetManager::GetRoot(CDasherNode *pParent, int
 
   pNewNode->iContext = iContext;
 
-  pNewNode->pLanguageModel = m_pLanguageModel;
-
   pNewNode->SetFlag(NF_SEEN, true);
 
 
@@ -168,8 +166,7 @@ CAlphabetManager::CAlphNode *CAlphabetManager::CreateGroupNode(CAlphNode *pParen
   pNewNode->iPhase = pParent->iPhase;
   // TODO: Sort out symbol for groups
   pNewNode->iSymbol = 0; //...but the Symbol is just a 0.
-  pNewNode->pLanguageModel = pParent->pLanguageModel;
-  pNewNode->iContext = pParent->pLanguageModel->CloneContext(pParent->iContext);
+  pNewNode->iContext = m_pLanguageModel->CloneContext(pParent->iContext);
 
   return pNewNode;
 }
@@ -246,8 +243,6 @@ CDasherNode *CAlphabetManager::CreateSymbolNode(CAlphNode *pParent, symbol iSymb
       pAlphNode->iSymbol = iSymbol;
 
       pAlphNode->iContext = CreateSymbolContext(pParent, iSymbol);
-
-    pAlphNode->pLanguageModel = pParent->pLanguageModel; // TODO: inconsistent with above?
   }
 
   return pNewNode;
@@ -326,7 +321,7 @@ void CAlphabetManager::PopulateChildrenWithSymbol( CAlphNode *pNode, int iExisti
 }
 
 CAlphabetManager::CAlphNode::~CAlphNode() {
-  pLanguageModel->ReleaseContext(iContext);
+  m_pMgr->m_pLanguageModel->ReleaseContext(iContext);
 }
 
 void CAlphabetManager::CAlphNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization) {
@@ -406,7 +401,6 @@ CDasherNode *CAlphabetManager::CAlphNode::RebuildParent() {
   pNewNode->m_iOffset = iNewOffset;
   pNewNode->iPhase = iNewPhase;
   pNewNode->iSymbol = iNewSymbol;
-  pNewNode->pLanguageModel = m_pMgr->m_pLanguageModel;
   pNewNode->iContext = iContext;
 
 
@@ -424,7 +418,7 @@ void CAlphabetManager::CAlphNode::SetFlag(int iFlag, bool bValue) {
   switch(iFlag) {
   case NF_COMMITTED:
     if(bValue && !GetFlag(NF_GAME) && m_pMgr->m_pInterface->GetBoolParameter(BP_LM_ADAPTIVE))
-      pLanguageModel->LearnSymbol(m_pMgr->m_iLearnContext, iSymbol);
+      m_pMgr->m_pLanguageModel->LearnSymbol(m_pMgr->m_iLearnContext, iSymbol);
     break;
   }
 }
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index 0031011..a119f86 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -80,7 +80,6 @@ namespace Dasher {
     
       symbol iSymbol;
       int iPhase;
-      CLanguageModel *pLanguageModel;
       CLanguageModel::Context iContext;
  
       int iGameOffset;
diff --git a/Src/DasherCore/MandarinAlphMgr.cpp b/Src/DasherCore/MandarinAlphMgr.cpp
index 601f715..85833b7 100644
--- a/Src/DasherCore/MandarinAlphMgr.cpp
+++ b/Src/DasherCore/MandarinAlphMgr.cpp
@@ -65,7 +65,6 @@ CAlphabetManager::CAlphNode *CMandarinAlphMgr::GetRoot(CDasherNode *pParent, int
     pNewNode->m_iOffset=max(0,iOffset)-1;
     pNewNode->iPhase=0;
     pNewNode->iSymbol=0;
-    pNewNode->pLanguageModel = m_pLanguageModel;
   } else {
     //probably rebuilding parent; call standard GetRoot, which'll extract the most recent symbol
     // (entered by the node (equivalent to that) which we are rebuilding)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]