-rw-r--r-- | inputmethods/dasher/PPMLanguageModel.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/inputmethods/dasher/PPMLanguageModel.cpp b/inputmethods/dasher/PPMLanguageModel.cpp index 137b07f..d767d16 100644 --- a/inputmethods/dasher/PPMLanguageModel.cpp +++ b/inputmethods/dasher/PPMLanguageModel.cpp | |||
@@ -46,41 +46,42 @@ CPPMLanguageModel::CPPMnode * CPPMLanguageModel::CPPMnode::add_symbol_to_node(in | |||
46 | } else { | 46 | } else { |
47 | if (*update) { // perform update exclusions | 47 | if (*update) { // perform update exclusions |
48 | search->count++; | 48 | search->count++; |
49 | *update=0; | 49 | *update=0; |
50 | } | 50 | } |
51 | return search; | 51 | return search; |
52 | } | 52 | } |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
57 | ///////////////////////////////////////////////////////////////////// | 57 | ///////////////////////////////////////////////////////////////////// |
58 | // CPPMLanguageModel defs | 58 | // CPPMLanguageModel defs |
59 | ///////////////////////////////////////////////////////////////////// | 59 | ///////////////////////////////////////////////////////////////////// |
60 | 60 | ||
61 | CPPMLanguageModel::CPPMLanguageModel(CAlphabet *_alphabet,int _normalization) | 61 | CPPMLanguageModel::CPPMLanguageModel(CAlphabet *_alphabet,int _normalization) |
62 | : CLanguageModel(_alphabet,_normalization) | 62 | : CLanguageModel(_alphabet,_normalization), root(0), m_rootcontext(0) |
63 | { | 63 | { |
64 | root=new CPPMnode(-1); | 64 | root=new CPPMnode(-1); |
65 | m_rootcontext=new CPPMContext(root,0); | 65 | m_rootcontext=new CPPMContext(root,0); |
66 | } | 66 | } |
67 | 67 | ||
68 | 68 | ||
69 | CPPMLanguageModel::~CPPMLanguageModel() | 69 | CPPMLanguageModel::~CPPMLanguageModel() |
70 | { | 70 | { |
71 | delete m_rootcontext; | ||
71 | delete root; | 72 | delete root; |
72 | } | 73 | } |
73 | 74 | ||
74 | 75 | ||
75 | bool CPPMLanguageModel::GetProbs(CContext *context,vector<unsigned int> &probs,double ) | 76 | bool CPPMLanguageModel::GetProbs(CContext *context,vector<unsigned int> &probs,double ) |
76 | // get the probability distribution at the context | 77 | // get the probability distribution at the context |
77 | { | 78 | { |
78 | // seems like we have to have this hack for VC++ | 79 | // seems like we have to have this hack for VC++ |
79 | CPPMContext *ppmcontext=static_cast<CPPMContext *> (context); | 80 | CPPMContext *ppmcontext=static_cast<CPPMContext *> (context); |
80 | 81 | ||
81 | 82 | ||
82 | int modelchars=GetNumberModelChars(); | 83 | int modelchars=GetNumberModelChars(); |
83 | int norm=CLanguageModel::normalization(); | 84 | int norm=CLanguageModel::normalization(); |
84 | probs.resize(modelchars); | 85 | probs.resize(modelchars); |
85 | CPPMnode *temp,*s; | 86 | CPPMnode *temp,*s; |
86 | int loop,total; | 87 | int loop,total; |