Changeset 1873 for trunk/gsdl/src/phind/generate/phrase.cpp
- Timestamp:
- 2001-01-30T12:08:49+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/phind/generate/phrase.cpp
r1631 r1873 180 180 // Does the phrase have a unique suffix/prefix extension? 181 181 // 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. 185 186 186 187 int Phrase::hasUniqueSuffixExtension() { … … 189 190 if (uniqueSuffixExtension == -1) { 190 191 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(); 200 193 201 194 // pointers to the phrase's first and last occurances in te suffixArray … … 235 228 ensurePrefixFound(); 236 229 237 // pointers to the phrase's first and last occurances in t e prefixArray230 // pointers to the phrase's first and last occurances in the prefixArray 238 231 symbol *fst = firstPrefix - length; 239 232 symbol *lst = lastPrefix - length; … … 249 242 // in STOPWORDS mode, make sure there is a unique next content symbol 250 243 else { 251 // if (firstSuffixIndex == 56962) cout << "Testing 1: s" << *fst << " = s" << *lst << endl;252 244 uniquePrefixExtension = 0; 253 245 while ((*fst == *lst) && (*fst > LASTDELIMITER)) { … … 266 258 267 259 268 // Expand a phrase with a unique suffix/prefix extensionby 1 symbol260 // Expand a phrase with a unique suffix/prefix by 1 symbol 269 261 // 270 262 // Note that in STOPWORDS mode a "unique extension" means a unique … … 274 266 275 267 int Phrase::expandUniqueSuffixExtensionByOne() { 276 assert(forward);277 268 assert(suffixFound); 278 269 assert(uniqueSuffixExtension == 1); … … 299 290 300 291 int Phrase::expandUniquePrefixExtensionByOne() { 301 assert(back);302 292 assert(prefixFound); 303 293 assert(uniquePrefixExtension == 1); … … 797 787 // Compare the length of two phrases 798 788 // 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. 801 791 802 792 bool isShorter(Phrase p1, Phrase p2) { … … 807 797 } 808 798 809 799 bool 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.