Diffstat (limited to 'inputmethods/dasher/PPMLanguageModel.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | inputmethods/dasher/PPMLanguageModel.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/inputmethods/dasher/PPMLanguageModel.cpp b/inputmethods/dasher/PPMLanguageModel.cpp index b725a2b..137b07f 100644 --- a/inputmethods/dasher/PPMLanguageModel.cpp +++ b/inputmethods/dasher/PPMLanguageModel.cpp @@ -51,62 +51,62 @@ CPPMLanguageModel::CPPMnode * CPPMLanguageModel::CPPMnode::add_symbol_to_node(in return search; } } ///////////////////////////////////////////////////////////////////// // CPPMLanguageModel defs ///////////////////////////////////////////////////////////////////// CPPMLanguageModel::CPPMLanguageModel(CAlphabet *_alphabet,int _normalization) : CLanguageModel(_alphabet,_normalization) { root=new CPPMnode(-1); m_rootcontext=new CPPMContext(root,0); } CPPMLanguageModel::~CPPMLanguageModel() { delete root; } -bool CPPMLanguageModel::GetProbs(CContext *context,vector<unsigned int> &probs,double addprob) +bool CPPMLanguageModel::GetProbs(CContext *context,vector<unsigned int> &probs,double ) // get the probability distribution at the context { // seems like we have to have this hack for VC++ CPPMContext *ppmcontext=static_cast<CPPMContext *> (context); int modelchars=GetNumberModelChars(); int norm=CLanguageModel::normalization(); probs.resize(modelchars); CPPMnode *temp,*s; int loop,total; int sym; - ulong spent=0; + // ulong spent=0; ulong size_of_slice; bool *exclusions=new bool [modelchars]; ulong uniform=modelchars; ulong tospend=norm-uniform; temp=ppmcontext->head; for (loop=0; loop <modelchars; loop++) { /* set up the exclusions array */ probs[loop]=0; exclusions[loop]=0; } while (temp!=0) { // Usprintf(debug,TEXT("tospend %u\n"),tospend); // DebugOutput(TEXT("round\n")); total=0; s=temp->child; while (s) { sym=s->symbol; if (!exclusions[s->symbol]) total=total+s->count; s=s->next; } if (total) { // Usprintf(debug,TEXT"escape %u\n"),tospend* size_of_slice=tospend; s=temp->child; @@ -171,49 +171,49 @@ void CPPMLanguageModel::AddSymbol(CPPMLanguageModel::CPPMContext &context,int sy temp=context.head->vine; context.head=context.head->add_symbol_to_node(symbol,&updatecnt); vineptr=context.head; context.order++; while (temp!=0) { vineptr->vine=temp->add_symbol_to_node(symbol,&updatecnt); vineptr=vineptr->vine; temp=temp->vine; } vineptr->vine=root; if (context.order>MAX_ORDER){ context.head=context.head->vine; context.order--; } } // update context with symbol 'Symbol' void CPPMLanguageModel::EnterSymbol(CContext* Context, modelchar Symbol) { CPPMLanguageModel::CPPMContext& context = * static_cast<CPPMContext *> (Context); CPPMnode *find; - CPPMnode *temp=context.head; + // CPPMnode *temp=context.head; while (context.head) { find =context.head->find_symbol(Symbol); if (find) { context.order++; context.head=find; // Usprintf(debug,TEXT("found context %x order %d\n"),head,order); // DebugOutput(debug); return; } context.order--; context.head=context.head->vine; } if (context.head==0) { context.head=root; context.order=0; } } void CPPMLanguageModel::LearnSymbol(CContext* Context, modelchar Symbol) { @@ -225,49 +225,49 @@ void CPPMLanguageModel::LearnSymbol(CContext* Context, modelchar Symbol) void CPPMLanguageModel::dumpSymbol(int symbol) { if ((symbol <= 32) || (symbol >= 127)) printf( "<%d>", symbol ); else printf( "%c", symbol ); } void CPPMLanguageModel::dumpString( char *str, int pos, int len ) // Dump the string STR starting at position POS { char cc; int p; for (p = pos; p<pos+len; p++) { cc = str [p]; if ((cc <= 31) || (cc >= 127)) printf( "<%d>", cc ); else printf( "%c", cc ); } } -void CPPMLanguageModel::dumpTrie( CPPMLanguageModel::CPPMnode *t, int d ) +void CPPMLanguageModel::dumpTrie( CPPMLanguageModel::CPPMnode *, int ) // diagnostic display of the PPM trie from node t and deeper { //TODO /* dchar debug[256]; int sym; CPPMnode *s; Usprintf( debug,TEXT("%5d %7x "), d, t ); //TODO: Uncomment this when headers sort out //DebugOutput(debug); if (t < 0) // pointer to input printf( " <" ); else { Usprintf(debug,TEXT( " %3d %5d %7x %7x %7x <"), t->symbol,t->count, t->vine, t->child, t->next ); //TODO: Uncomment this when headers sort out //DebugOutput(debug); } dumpString( dumpTrieStr, 0, d ); Usprintf( debug,TEXT(">\n") ); //TODO: Uncomment this when headers sort out //DebugOutput(debug); if (t != 0) { s = t->child; |