~ubuntu-branches/ubuntu/karmic/enchant/karmic

« back to all changes in this revision

Viewing changes to src/myspell/suggestmgr.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-12-18 20:44:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051218204402-q3vjavlsib0rd0vq
Tags: 1.2.0-0ubuntu1
* New upstream version
* debian/libenchant1c2a.shlibs:
  - update

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
  for (int j = 0; j < nummap; j++) {
119
119
    if (strchr(maptable[j].set,c) != 0) {
120
120
      in_map = 1;
121
 
      char * newword = strdup(word);
 
121
      char * newword = mystrdup(word);
122
122
      for (int k = 0; k < maptable[j].len; k++) {
123
123
        *(newword + i) = *(maptable[j].set + k);
124
124
        ns = map_related(newword, (i+1), wlst, ns, maptable, nummap);
398
398
  int thresh = 0;
399
399
  char * mw = NULL;
400
400
  for (int sp = 1; sp < 4; sp++) {
401
 
     mw = strdup(word);
 
401
     mw = mystrdup(word);
402
402
     for (int k=sp; k < n; k+=4) *(mw + k) = '*';
403
403
     thresh = thresh + ngram(n, word, mw, NGRAM_ANY_MISMATCH);
404
404
     free(mw);
431
431
                                        rp->astr, rp->alen);
432
432
        for (int k = 0; k < nw; k++) {
433
433
           sc = ngram(n, word, glst[k].word, NGRAM_ANY_MISMATCH);
434
 
           if (sc > thresh) {
435
 
              if (sc > gscore[lp]) {
436
 
                 if (guess[lp]) free (guess[lp]);
437
 
                 gscore[lp] = sc;
438
 
                 guess[lp] = glst[k].word;
439
 
                 lval = sc;
440
 
                 for (j=0; j < MAX_GUESS; j++)
441
 
                    if (gscore[j] < lval) {
442
 
                       lp = j;
443
 
                       lval = gscore[j];
444
 
                    }
445
 
              } else {
446
 
                 free (glst[k].word);  
447
 
              }
448
 
           }            
 
434
           if (sc > thresh)
 
435
           {
 
436
                if (sc > gscore[lp])
 
437
                {
 
438
                        if (guess[lp]) free(guess[lp]);
 
439
                        gscore[lp] = sc;
 
440
                        guess[lp] = glst[k].word;
 
441
                        glst[k].word = NULL;
 
442
                        lval = sc;
 
443
                        for (j=0; j < MAX_GUESS; j)
 
444
                        {
 
445
                                if (gscore[j] < lval)
 
446
                                {
 
447
                                        lp = j;
 
448
                                        lval = gscore[j];
 
449
                                }
 
450
                        }
 
451
                }
 
452
           }
 
453
           free (glst[k].word);
 
454
           glst[k].word = NULL;
 
455
           glst[k].allow = 0;
449
456
        }
450
457
      }
451
458
  }