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/phrase.cpp

    r1631 r1873  
    180180// Does the phrase have a unique suffix/prefix extension?
    181181//
    182 // If uniqueSuffixExtensions is 1, then we do.
    183 // If it is > 1 then we do not.
    184 // If it is -1 then we have to check in the suffix array.
     182// For suffix:
     183//   If uniqueSuffixExtensions is 1, then phrase has some unique expansion.
     184//   If it is 0 then it does not.  If it is -1 then we don't know, and have
     185//   to calculate it from the suffix array.  Same goes for prefixes.
    185186
    186187int Phrase::hasUniqueSuffixExtension() {
     
    189190  if (uniqueSuffixExtension == -1) {
    190191
    191     if (!suffixFound) {
    192       findFirstAndLastSuffix();
    193     }
    194 
    195     /*    if (firstSuffixIndex == 56957) {
    196       cout << "Testing suffix expansion: " << toString() << "\n";
    197       cout << "mode: " << phraseMode << endl;
    198     }
    199     */
     192    ensureSuffixFound();
    200193
    201194    // pointers to the phrase's first and last occurances in te suffixArray
     
    235228    ensurePrefixFound();
    236229
    237     // pointers to the phrase's first and last occurances in te prefixArray
     230    // pointers to the phrase's first and last occurances in the prefixArray
    238231    symbol *fst = firstPrefix - length;
    239232    symbol *lst = lastPrefix - length;
     
    249242    // in STOPWORDS mode, make sure there is a unique next content symbol
    250243    else {
    251       // if (firstSuffixIndex == 56962) cout << "Testing 1: s" << *fst << " = s" << *lst << endl;
    252244      uniquePrefixExtension = 0;
    253245      while ((*fst == *lst) && (*fst > LASTDELIMITER)) {
     
    266258
    267259
    268 // Expand a phrase with a unique suffix/prefix extension by 1 symbol
     260// Expand a phrase with a unique suffix/prefix by 1 symbol
    269261//
    270262// Note that in STOPWORDS mode a "unique extension" means a unique
     
    274266
    275267int Phrase::expandUniqueSuffixExtensionByOne() {
    276   assert(forward);
    277268  assert(suffixFound);
    278269  assert(uniqueSuffixExtension == 1);
     
    299290
    300291int Phrase::expandUniquePrefixExtensionByOne() {
    301   assert(back);
    302292  assert(prefixFound);
    303293  assert(uniquePrefixExtension == 1);
     
    797787// Compare the length of two phrases
    798788//
    799 // Given two phrases, return true if the first is shorter,
    800 // otherwise return false.  For use with the STL sort function.
     789// Given two phrases, return true if the first is shorter/longer,
     790// otherwise return false.  For use in various sort functions.
    801791
    802792bool isShorter(Phrase p1, Phrase p2) {
     
    807797}
    808798
    809 
     799bool isLonger(Phrase p1, Phrase p2) {
     800  if (p1.length > p2.length) {
     801    return true;
     802  }
     803  return false;
     804}
     805
     806
Note: See TracChangeset for help on using the changeset viewer.