private void ismEndings() { if (endsIn('i', 's', 'm')) { /* * this is a very productive ending, so just * accept it */ word.setLength(j + 1); k = j; lookup(); } return; }
private void icEndings() { if (endsIn('i', 'c')) { word.setLength(j + 3); word.append("al"); /* try converting -ic to -ical */ k = j + 4; if (lookup()) return; word.setCharAt(j + 1, 'y'); /* try converting -ic to -y */ word.setLength(j + 2); k = j + 1; if (lookup()) return; word.setCharAt(j + 1, 'e'); /* try converting -ic to -e */ if (lookup()) return; word.setLength(j + 1); /* try removing -ic altogether */ k = j; if (lookup()) return; word.append("ic"); /* restore the original ending */ k = j + 2; // nolookup() } return; }
private void mentEndings() { int old_k = k; if (endsIn('m', 'e', 'n', 't')) { word.setLength(j + 1); k = j; if (lookup()) return; word.append("ment"); k = old_k; // nolookup } return; }
private void ncyEndings() { if (endsIn('n', 'c', 'y')) { if (!((word.charAt(j) == 'e') || (word.charAt(j) == 'a'))) return; word.setCharAt(j + 2, 't'); /* try converting -ncy to -nt */ word.setLength(j + 3); k = j + 2; if (lookup()) return; word.setCharAt(j + 2, 'c'); /* the default is to convert it to -nce */ word.unsafeWrite('e'); k = j + 3; lookup(); } return; }
private void nessEndings() { if (endsIn('n', 'e', 's', 's')) { /* * this is a very productive endings, so * just accept it */ word.setLength(j + 1); k = j; if (word.charAt(j) == 'i') word.setCharAt(j, 'y'); lookup(); } return; }
word.setLength(j + 3); k--; if (lookup()) /* ensure calories -> calorie */ return; k++; word.unsafeWrite('s'); setSuffix("y"); lookup(); } else if (endsIn('e', 's')) { if (tryE && lookup()) return; if (lookup()) return; k++; if (!tryE) lookup(); // if we didn't try the "e" ending before return; } else { lookup();
private void nceEndings() { int old_k = k; char word_char; if (endsIn('n', 'c', 'e')) { word_char = word.charAt(j); if (!((word_char == 'e') || (word_char == 'a'))) return; word.setLength(j); word.unsafeWrite('e'); /* try converting -e/ance to -e (adherance/adhere) */ k = j; if (lookup()) return; word.setLength(j); /* * try removing -e/ance altogether * (disappearance/disappear) */ k = j - 1; if (lookup()) return; word.unsafeWrite(word_char); /* restore the original ending */ word.append("nce"); k = old_k; // nolookup() because we restored the original ending } return; }
word.setLength(j + 1); k = j; if (lookup()) /* try just removing the -al */ return; word.setLength(j); k = j - 1; if (lookup()) return; word.unsafeWrite(word.charAt(j - 1)); word.unsafeWrite('e'); /* try removing the -al and adding -e */ k = j + 1; if (lookup()) return; if (lookup()) return; word.setLength(j - 1); /* try removing -ical */ k = j - 2; if (lookup()) return; if (lookup()) return; lookup(); return; if (lookup()) return; word.append("ial"); k = old_k; lookup();
private void izeEndings() { int old_k = k; if (endsIn('i', 'z', 'e')) { word.setLength(j + 1); /* try removing -ize entirely */ k = j; if (lookup()) return; word.unsafeWrite('i'); if (doubleC(j)) { /* allow for a doubled consonant */ word.setLength(j); k = j - 1; if (lookup()) return; word.unsafeWrite(word.charAt(j - 1)); } word.setLength(j + 1); word.unsafeWrite('e'); /* try removing -ize and adding -e */ k = j + 1; if (lookup()) return; word.setLength(j + 1); word.append("ize"); k = old_k; // nolookup() } return; }
word.setLength(j + 1); /* try just removing -ity */ k = j; if (lookup()) return; word.unsafeWrite('e'); /* try removing -ity and adding -e */ k = j + 1; if (lookup()) return; word.setCharAt(j + 1, 'i'); word.append("ty"); word.append("le"); /* convert to -ble */ k = j; lookup(); return; word.unsafeWrite('e'); /* convert to -ive */ k = j + 1; lookup(); return; word.setLength(j + 1); k = j; lookup(); return; if (lookup()) return;
if (lookup()) return; if (doubleC(k)) { /* allow for a doubled consonant */ word.setLength(k); k--; if (lookup()) return; k++; word.unsafeWrite(word.charAt(k - 1)); word.unsafeWrite('e'); /* try removing -a/ible and adding -e */ k = j; if (lookup()) return; word.setLength(j); word.append("ate"); /* try removing -able and adding -ate */ if (lookup()) return; word.setLength(j);
lookup(); return; word.setLength(j); k = j - 1; if (lookup()) return; word.unsafeWrite(word.charAt(j - 1)); /* restore the doubled consonant */ word.setLength(j + 1); k = j; if (lookup()) /* yes, so check against the dictionary */ return; word.setCharAt(j, 'i'); /* restore the endings */ word.setLength(j); k = j - 1; if (lookup()) return; word.unsafeWrite('e'); if (lookup()) return; word.setLength(j + 1); /* try removing -er/-or */ k = j; if (lookup()) return; word.unsafeWrite('e'); /* try removing -or and adding -e */ k = j + 1; if (lookup()) return; word.setLength(j + 1); word.unsafeWrite(word_char);
word.unsafeWrite('e'); k = j + 3; lookup(); return; word.unsafeWrite('e'); k = j + 1; if (lookup()) /* word.unsafeWrite('e'); k = j + 3; if (lookup()) /* remove -ion and add `e', and check against the dictionary */ return; /* (elmination -> eliminate) */ if (lookup()) return; if (lookup()) return; word.unsafeWrite('y'); k = j + 1; if (lookup()) /* word.unsafeWrite('e'); k = j + 1; if (lookup()) /* remove -ion and add `e', and check against the dictionary */ return; if (lookup()) /* remove -ion, and if it's found, treat that as the root */ return;
private void ismEndings() { if (endsIn('i', 's', 'm')) { /* * this is a very productive ending, so just * accept it */ word.setLength(j + 1); k = j; lookup(); } return; }
private void mentEndings() { int old_k = k; if (endsIn('m', 'e', 'n', 't')) { word.setLength(j + 1); k = j; if (lookup()) return; word.append("ment"); k = old_k; // nolookup } return; }
private void nessEndings() { if (endsIn('n', 'e', 's', 's')) { /* * this is a very productive endings, so * just accept it */ word.setLength(j + 1); k = j; if (word.charAt(j) == 'i') word.setCharAt(j, 'y'); lookup(); } return; }