Ignore:
Timestamp:
2001-01-30T12:08:49+13:00 (23 years ago)
Author:
paynter
Message:

Fixed a bug iin the Phrase extraction alogrithm that had the
"candidates" in the GetMinimalExpansions function sorted backwards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/phind/generate/suffix.cpp

    r1683 r1873  
    11/**********************************************************************
    22 *
    3  * suffix.h -- Extract the repeated phrases in the input using
    4  *             suffix and prefix arrays.
     3 * suffix.cpp -- Extract the repeated phrases in the input using
     4 *               suffix and prefix arrays.
    55 *
    6  * Copyright 2000 Gordon W. Paynter ([email protected])
     6 * Copyright 2000 Gordon W. Paynter
    77 * Copyright 2000 The New Zealand Digital Library Project
    88 *
     
    507507
    508508  // 2.2 Sort the candidates by phrase length
    509   // sort(candidates.begin(), candidates.end(), isShorter);
    510   make_heap(candidates.begin(), candidates.end(), isShorter);
    511 
     509  make_heap(candidates.begin(), candidates.end(), isLonger);
    512510
    513511  // 3. While candidates is non-empty, confirm the phrases it
     
    516514
    517515    // 3.1 Get next candidate
    518     //Phrase c = candidates.front();
    519     //candidates.erase(candidates.begin());
    520     pop_heap(candidates.begin(), candidates.end(), isShorter);
     516    pop_heap(candidates.begin(), candidates.end(), isLonger);
    521517    Phrase c = candidates.back();
    522518    candidates.pop_back();
     
    538534    // cout << "expanding prefix " << c.toString() << "=> ";
    539535    c.expandUniquePrefixExtensionByOne();
    540     //candidates.push_back(c);
    541     //sort(candidates.begin(), candidates.end(), isShorter);
    542536    candidates.push_back(c);
    543     push_heap(candidates.begin(), candidates.end(), isShorter);
     537    push_heap(candidates.begin(), candidates.end(), isLonger);
    544538     }
    545539   
     
    572566      else if (c.hasUniqueSuffixExtension()) {
    573567    c.expandUniqueSuffixExtensionByOne();
    574     //candidates.push_back(c);
    575     //sort(candidates.begin(), candidates.end(), isShorter);
    576568    candidates.push_back(c);
    577     push_heap(candidates.begin(), candidates.end(), isShorter);
     569    push_heap(candidates.begin(), candidates.end(), isLonger);
    578570      }
    579571   
Note: See TracChangeset for help on using the changeset viewer.