void step4(double *assignment, double *distMatrix, char *starMatrix, char *newStarMatrix, char *primeMatrix, char *coveredColumns, char *coveredRows, int nOfRows, int nOfColumns, int minDim, int row, int col) { int n, starRow, starCol, primeRow, primeCol; int nOfElements = nOfRows*nOfColumns; /* generate temporary copy of starMatrix */ for(n=0; n<nOfElements; n++) newStarMatrix[n] = starMatrix[n]; /* star current zero */ newStarMatrix[row + nOfRows*col] = 1; /* find starred zero in current column */ starCol = col; for(starRow=0; starRow<nOfRows; starRow++) if(starMatrix[starRow + nOfRows*starCol]) break; while(starRow<nOfRows) { /* unstar the starred zero */ newStarMatrix[starRow + nOfRows*starCol] = 0; /* find primed zero in current row */ primeRow = starRow; for(primeCol=0; primeCol<nOfColumns; primeCol++) if(primeMatrix[primeRow + nOfRows*primeCol]) break; /* star the primed zero */ newStarMatrix[primeRow + nOfRows*primeCol] = 1; /* find starred zero in current column */ starCol = primeCol; for(starRow=0; starRow<nOfRows; starRow++) if(starMatrix[starRow + nOfRows*starCol]) break; } /* use temporary copy as new starMatrix */ /* delete all primes, uncover all rows */ for(n=0; n<nOfElements; n++) { primeMatrix[n] = 0; starMatrix[n] = newStarMatrix[n]; } for(n=0; n<nOfRows; n++) coveredRows[n] = 0; /* move to step 2a */ step2a(assignment, distMatrix, starMatrix, newStarMatrix, primeMatrix, coveredColumns, coveredRows, nOfRows, nOfColumns, minDim); }
static void step4(int *ix, int *mdist, mat_t mstar, mat_t nmstar, mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, int dmin, int row, int col) { int n, rstar, cstar, primeRow, primeCol; /* generate temporary copy of mstar */ memcpy(nmstar, mstar, sizeof(mat_t)); /* star current zero */ SET2(nmstar, row, col); /* find starred zero in current column */ cstar = col; for (rstar = 0; rstar < nrows; rstar++) if (GET2(mstar, rstar, cstar)) break; while (rstar < nrows) { /* unstar the starred zero */ CLEAR2(nmstar, rstar, cstar); /* find primed zero in current row */ primeRow = rstar; for (primeCol = 0; primeCol < ncols; primeCol++) if (GET2(mprime, primeRow, primeCol)) break; /* star the primed zero */ SET2(nmstar, primeRow, primeCol); /* find starred zero in current column */ cstar = primeCol; for (rstar = 0; rstar < nrows; rstar++) if (GET2(mstar, rstar, cstar)) break; } /* use temporary copy as new mstar */ /* delete all primes, uncover all rows */ memcpy(mstar, nmstar, sizeof(mat_t)); memset(mprime, 0, sizeof(mat_t)); memset(crow, 0, sizeof(col_t)); /* move to step 2a */ step2a(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin); }
String FrenchStemmer::stem(const String& term) { if (!isStemmable(term)) return term; // Use lowercase for medium stemming. stringBuffer = StringUtils::toLower(term); // reset the booleans modified = false; suite = false; treatVowels(stringBuffer); setStrings(); step1(); if (!modified || suite) { if (!RV.empty()) { suite = step2a(); if (!suite) step2b(); } } if (modified || suite) step3(); else step4(); step5(); step6(); return stringBuffer; }