Changeset 9604


Ignore:
Timestamp:
2005-04-08T11:18:58+12:00 (19 years ago)
Author:
kjdon
Message:

added some x++ -> ++x changes submitted by Emanuel Dejanu

Location:
trunk/gsdl/src/phind/generate
Files:
2 edited

Legend:

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

    r8362 r9604  
    185185
    186186  stream << "s" << *s++;
    187   for (cellcount i = 1; i < phrase.length; i++)
     187  for (cellcount i = 1; i < phrase.length; ++i)
    188188    stream << " s" << *s++;
    189189
     
    203203  sprintf(str, "s%d", *s++);
    204204
    205   for (cellcount i = 1; i < length; i++) {
     205  for (cellcount i = 1; i < length; ++i) {
    206206    sprintf(str, "%s s%d", str, *s++);
    207207  }
     
    224224  symbol *p = forward;
    225225 
    226   for (cellcount i = 0; i < length; i++) {
     226  for (cellcount i = 0; i < length; ++i) {
    227227    if (*p > *words) {
    228228      return 1;
     
    230230      return -1;
    231231    } else {
    232       *p++;
    233       *words++;
     232      ++*p;
     233      ++*words;
    234234    }
    235235  }
     
    244244  symbol *p = back;
    245245 
    246   for (cellcount i = 0; i < length; i++) {
     246  for (cellcount i = 0; i < length; ++i) {
    247247    if (*p > *words) {
    248248      return -1;
     
    250250      return 1;
    251251    } else {
    252       *p--;
    253       *words--;
     252      --*p;
     253      --*words;
    254254    }
    255255  }
     
    294294      break;
    295295    }
    296     fst++;
    297     lst++;
     296    ++fst;
     297    ++lst;
    298298      }
    299299    }
     
    330330      break;
    331331    }
    332     fst--;
    333     lst--;
     332    --fst;
     333    --lst;
    334334      }
    335335    }
     
    361361
    362362    while (*next < firstContentSymbol) {
    363       next++;
    364       newlength++;
     363      ++next;
     364      ++newlength;
    365365    }
    366366    increaseSuffixLength(newlength);
     
    384384    cellcount newlength = length + 1;
    385385    while (*next < firstContentSymbol) {
    386       next--;
    387       newlength++;
     386      --next;
     387      --newlength;
    388388    }
    389389    increasePrefixLength(newlength);
     
    766766  // Calculate the length over which the phrases match
    767767  while((*fst == *lst) && (*fst > LASTDELIMITER)) {
    768     len++;
     768    ++len;
    769769    if (*fst > lastStopSymbol) content_len = len;
    770     fst++;
    771     lst++;
     770    ++fst;
     771    ++lst;
    772772  }
    773773
     
    809809  // Calculate the length over which the phrases match
    810810  while((*fst == *lst) && (*fst > LASTDELIMITER)) {
    811     len++;
     811    ++len;
    812812    if (*fst > lastStopSymbol) content_len = len;
    813     fst--;
    814     lst--;
     813    --fst;
     814    --lst;
    815815  }
    816816
  • trunk/gsdl/src/phind/generate/suffix.cpp

    r8362 r9604  
    142142  // Try to add each candidate to the results set, ignoring the non-minimal
    143143  for (vector<Phrase>::iterator candidate = candidates.begin();
    144        candidate != candidates.end(); candidate++) {
     144       candidate != candidates.end(); ++candidate) {
    145145
    146146    // Make a copy of candidate to mutilate while performing sub-phrase checks
     
    187187  // If the two elements are the same, examine the next one
    188188  while (*pa == *pb) {
    189     *pa++;
    190     *pb++;
     189    ++*pa;
     190    ++*pb;
    191191  }
    192192
     
    217217  // If the two elements are the same, examine the next one
    218218  while (*pa == *pb) {
    219     *pa--;
    220     *pb--;
     219    --*pa;
     220    --*pb;
    221221  }
    222222
     
    275275  symbol word;
    276276  while (inFile1 >> word) {
    277     inputLength++;
     277    ++inputLength;
    278278  }
    279279  inFile1.close();
     
    305305    symbols[next++] = word;
    306306    if (word == DOCUMENTSTART) {
    307       numberOfDocuments++;
     307      ++numberOfDocuments;
    308308    }
    309309  }
     
    332332
    333333  // Initialise the document frequency array
    334   //  for (cellindex i = 0; i < numberOfDocuments; i++) {
     334  //  for (cellindex i = 0; i < numberOfDocuments; ++i) {
    335335  // frequency[i] = 0;
    336336  //}
     
    345345
    346346  // search for the document in which each occurence of the phrase is found
    347   for (cellcount j = p.firstSuffixIndex; j <= p.lastSuffixIndex; j++) {
     347  for (cellcount j = p.firstSuffixIndex; j <= p.lastSuffixIndex; ++j) {
    348348   
    349349    // cout << "looking for phrase at suffixArray[" << j << "]\n";
     
    368368      if (begin == end) {
    369369    if (frequency[begin] == 0) {
    370       df++;
     370      ++df;
    371371    }
    372     frequency[begin]++;
     372    ++frequency[begin];
    373373    found = true;
    374374      }
     
    384384      if ((d == numberOfDocuments - 1) || (target < documentArray[d+1])) {
    385385        if (frequency[d] == 0) {
    386           df++;
     386          ++df;
    387387        }
    388         frequency[d]++;
     388        ++frequency[d];
    389389        found = true;
    390390      } else { 
     
    455455
    456456  // to begin with, everything is empty
    457   //  for (cellcount i = 0; i < inputLength; i++) {
     457  //  for (cellcount i = 0; i < inputLength; ++i) {
    458458  // phraseMemory[i] = 0;
    459459  //}
     
    475475  // create a char with just the bit corresponding to length set
    476476  unsigned char newbit = 1;
    477   for (cellcount i = 1; i < length; i++) {
     477  for (cellcount i = 1; i < length; ++i) {
    478478    newbit <<= 1;
    479479  }
     
    493493  // create a char with just the bit corresponding to length set
    494494  unsigned char newbit = 1;
    495   for (cellcount i = 1; i < length; i++) {
     495  for (cellcount i = 1; i < length; ++i) {
    496496    newbit <<= 1;
    497497  }
     
    532532  }
    533533  hashTableFile.open(hashTableFileName, ios::in | ios::out);
    534   for (cellcount i = 0; i < bigPrime; i++) {
     534  for (cellcount i = 0; i < bigPrime; ++i) {
    535535    hashTableFile.write((char *) &example, sizeof(example));
    536536  }
     
    707707
    708708  cellcount content=0;
    709   for (cellcount i=0; i<inputLength; i++) {
    710     if (symbols[i]>=firstContent) content++;
     709  for (cellcount i=0; i<inputLength; ++i) {
     710    if (symbols[i]>=firstContent) ++content;
    711711  }
    712712
     
    781781
    782782  // Initialise prefix and suffix arrays, only use the needed suffixes
    783   for (cellcount j = 0, here = 0; j < inputLength; j++) {
     783  for (cellcount j = 0, here = 0; j < inputLength; ++j) {
    784784    if (symbols[j]>=firstContent) {
    785785      suffixArray[here] = &symbols[j];
    786786      prefixArray[here] = &symbols[j];
    787       here++;
     787      ++here;
    788788    }   
    789789  }
     
    812812  // just scan through the input text to find the doc starts
    813813  cellindex d = 0;
    814   for (cellindex i=0; i<inputLength; i++) {
     814  for (cellindex i=0; i<inputLength; ++i) {
    815815    if (symbols[i] == DOCUMENTSTART) {
    816816      documentArray[d] = &symbols[i];
    817       d++;
     817      ++d;
    818818    }
    819819  }
     
    911911
    912912    // write the results
    913     for (cellcount k = 0; k < result.size(); k++) {
     913    for (cellcount k = 0; k < result.size(); ++k) {
    914914      if (k) {
    915915        phraseData << ",";
     
    917917      phraseData << result[k].firstSuffixIndex << "-" << result[k].length;
    918918      outPhrase << result[k].firstSuffixIndex << " " << result[k].length << endl;
    919       outPhraseCounter++;
     919      ++outPhraseCounter;
    920920    }
    921921    result.clear();
     
    926926
    927927    // write the documents
    928     for (cellcount m = 0, first = 1; m < numberOfDocuments; m++) {
     928    for (cellcount m = 0, first = 1; m < numberOfDocuments; ++m) {
    929929      if (documentFrequency[m]) {
    930930        if (first) {
     
    946946
    947947    phraseData << endl;
    948     phraseCounter++;
     948    ++phraseCounter;
    949949
    950950    // feedback
     
    967967
    968968    // Start a new pass
    969     phrasePass++;
     969    ++phrasePass;
    970970    if (verbosity) {
    971971      cout << "Starting pass " << phrasePass << endl;
     
    10201020    phraseData << result.size() << ":";
    10211021
    1022     for (cellcount i = 0; i < result.size(); i++) {
     1022    for (cellcount i = 0; i < result.size(); ++i) {
    10231023      if (i) {
    10241024        phraseData << ",";
     
    10261026      phraseData << result[i].firstSuffixIndex << "-" << result[i].length;
    10271027      outPhrase << result[i].firstSuffixIndex << " " << result[i].length << endl;
    1028       outPhraseCounter++;
     1028      ++outPhraseCounter;
    10291029    }
    10301030    result.clear();
     
    10401040
    10411041      // write the documents
    1042       for (cellcount i = 0, first = 1; i < numberOfDocuments; i++) {
     1042      for (cellcount i = 0, first = 1; i < numberOfDocuments; ++i) {
    10431043    if (documentFrequency[i]) {
    10441044      if (first) {
     
    10601060     
    10611061      phraseData << endl;
    1062       phraseCounter++;
     1062      ++phraseCounter;
    10631063
    10641064      // feedback
Note: See TracChangeset for help on using the changeset viewer.