Step 3:
Search for the longest among the following suffixes, and, if found and in R1, perform the action indicated.
480868
public function step3()
    {
        // ational+:   replace by ate
        if ($this->searchIfInR1(array('ational')) !== false) {
            $this->word = preg_replace('#(ational)$#u', 'ate', $this->word);
            return true;
        }

        // tional+:   replace by tion
        if ($this->searchIfInR1(array('tional')) !== false) {
            $this->word = preg_replace('#(tional)$#u', 'tion', $this->word);
            return true;
        }

        // alize:   replace by al
        if ($this->searchIfInR1(array('alize')) !== false) {
            $this->word = preg_replace('#(alize)$#u', 'al', $this->word);
            return true;
        }

        // icate   iciti   ical:   replace by ic
        if ($this->searchIfInR1(array('icate', 'iciti', 'ical')) !== false) {
            $this->word = preg_replace('#(icate|iciti|ical)$#u', 'ic', $this->word);
            return true;
        }

        // ful   ness:   delete
        if ( ($position = $this->searchIfInR1(array('ful', 'ness'))) !== false) {
            $this->word = Utf8::substr($this->word, 0, $position);
            return true;
        }

        // ative*:   delete if in R2
        if ( (($position = $this->searchIfInR1(array('ative'))) !== false) && ($this->inR2($position)) )  {
            $this->word = Utf8::substr($this->word, 0, $position);
            return true;
        }

        return false;
    }
374784
def delete_suffixes(self, word):
        
        length = len(word)
        suffixes = ['al', 'ance', 'ence', 'er', 'ic', 'able', 'ible',
                    'ant', 'ement', 'ment', 'ent', 'ism', 'ate',
                    'iti', 'ous', 'ive', 'ize']

        for suffix in suffixes:
            if word.endswith(suffix) and self.r2 <= (length - len(suffix)):
                word = word[:-len(suffix)]
                return word

        if word.endswith('ion') and self.r2 <= (length - 3):
            if word[length - 4] in 'st':
                word = word[:-3]

        return word
114299
private static function step3(&$word, $rvIndex)
    {
        // Delete suffix i if in RV and preceded by c
        if (self::searchIfInRv($word, array('i'), $rvIndex) !== false) {
            $letter = self::substr($word, -2, 1);

            if ($letter == 'c') {
                $word = self::substr($word, 0, -1);
            }

            return true;
        }

        return false;
    }
1327595
def _step3(self, word):
        """"""

        ch = word[-1]

        if ch == 'e':
            if word.endswith("icate"):
                return word[:-3] if self._m(word, len(word)-6) else word
            elif word.endswith("ative"):
                return word[:-5] if self._m(word, len(word)-6) else word
            elif word.endswith("alize"):
                return word[:-3] if self._m(word, len(word)-6) else word
            else:
                return word
        elif ch == 'i':
            if word.endswith("iciti"):
                return word[:-3] if self._m(word, len(word)-6) else word
            else:
                return word
        elif ch == 'l':
            if word.endswith("ical"):
                return word[:-2] if self._m(word, len(word)-5) else word
            elif word.endswith("ful"):
                return word[:-3] if self._m(word, len(word)-4) else word
            else:
                return word
        elif ch == 's':
            if word.endswith("ness"):
                return word[:-4] if self._m(word, len(word)-5) else word
            else:
                return word

        else:
            return word
208480
def strip_suffix(string, suffix):
    """"""
    if string.endswith(suffix):
        return string[:-(len(suffix))]
    return string
577976
public static boolean match(final String stringToMatch, final String suffixes[])
	{
		for (final String suffix : suffixes)
		{
			final int suffixesLength = suffix.length();
			final int stringToMatchLength = stringToMatch.length();
			final int result = stringToMatchLength - suffixesLength;
			final String extensionToMatch = stringToMatch.substring(result, stringToMatchLength);
			final boolean equals = extensionToMatch.equalsIgnoreCase(suffix);
			if (stringToMatchLength >= suffixesLength && equals)
			{
				return true;
			}
		}
		return false;
	}
748888
private function step4()
    {
        //If the word ends s, not preceded by a, i, o, u, è or s, delete it.
        if (preg_match('#[^aiouès]s$#', $this->word)) {
            $this->word = Utf8::substr($this->word, 0, -1);
        }

        // In the rest of step 4, all tests are confined to the RV region.
        // ion
        //      delete if in R2 and preceded by s or t
        if ( (($position = $this->searchIfInRv(array('ion'))) !== false) && ($this->inR2($position)) ) {
            $before = $position - 1;
            $letter = Utf8::substr($this->word, $before, 1);
            if ( $this->inRv($before) && (($letter == 's') || ($letter == 't')) ) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }
            return true;
        }

        // ier   ière   Ier   Ière
        //      replace with i
        if ( ($this->searchIfInRv(array('ier', 'ière', 'Ier', 'Ière'))) !== false) {
            $this->word = preg_replace('#(ier|ière|Ier|Ière)$#u', 'i', $this->word);
            return true;
        }

        // e
        //      delete
        if ( ($this->searchIfInRv(array('e'))) !== false) {
            $this->word = Utf8::substr($this->word, 0, -1);
            return true;
        }

        // ë
        //      if preceded by gu, delete
        if ( ($position = $this->searchIfInRv(array('guë'))) !== false) {
            if ($this->inRv($position+2)) {
                $this->word = Utf8::substr($this->word, 0, -1);
                return true;
            }
        }

        return false;
    }
11849
def replace_suffixes_2(self, word):
        
        has_vowel = False

        if word.endswith('eed'):
            if len(word) >= self.r1:
                word = word[:-3] + 'ee'
            return word

        elif word.endswith('eedly'):
            if len(word) >= self.r1:
                word = word[:-5] + 'ee'
            return word

        elif word.endswith('ed'):
            for vowel in self.vowels:
                if vowel in word[:-2]:
                    has_vowel = True
                    word = word[:-2]
                    break

        elif word.endswith('edly'):
            for vowel in self.vowels:
                if vowel in word[:-4]:
                    has_vowel = True
                    word = word[:-4]
                    break

        elif word.endswith('ing'):
            for vowel in self.vowels:
                if vowel in word[:-3]:
                    has_vowel = True
                    word = word[:-3]
                    break

        elif word.endswith('ingly'):
            for vowel in self.vowels:
                if vowel in word[:-5]:
                    has_vowel = True
                    word = word[:-5]
                    break

        # Be sure to only perform one of these.
        if has_vowel:
            length = len(word)
            if word[length - 2:] in ['at', 'bl', 'iz']:
                word += 'e'
            elif word[length - 2:] in self.doubles:
                word = word[:-1]
            elif self.is_short(word):
                word += 'e'

        return word
865356
def suffix?(suffix, text)
      len = suffix.length
      len <= text.length and suffix == text[-len, len]
    end
632132
private function step3()
    {
        // leg   eleg   ig   eig   lig   elig   els   lov   elov   slov   hetslov
        if ( ($position = $this->searchIfInR1(array(
            'hetslov', 'eleg', 'elov', 'slov', 'elig', 'eig', 'lig', 'els', 'lov', 'leg', 'ig'
        ))) !== false) {
            $this->word = Utf8::substr($this->word, 0, $position);
        }
    }
1056008
private final void step3() {
        if (k == 0) {
            return;
        }

        switch (b[k - 1]) {
            case 'a':
                if (endWith("ational")) {
                    r("ate");
                    break;
                }
                if (endWith("tional")) {
                    r("tion");
                    break;
                }
                break;
            case 'c':
                if (endWith("enci")) {
                    r("ence");
                    break;
                }
                if (endWith("anci")) {
                    r("ance");
                    break;
                }
                break;
            case 'e':
                if (endWith("izer")) {
                    r("ize");
                    break;
                }
                break;
            case 'l':
                if (endWith("bli")) {
                    r("ble");
                    break;
                }
                if (endWith("alli")) {
                    r("al");
                    break;
                }
                if (endWith("entli")) {
                    r("ent");
                    break;
                }
                if (endWith("eli")) {
                    r("e");
                    break;
                }
                if (endWith("ousli")) {
                    r("ous");
                    break;
                }
                break;
            case 'o':
                if (endWith("ization")) {
                    r("ize");
                    break;
                }
                if (endWith("ation")) {
                    r("ate");
                    break;
                }
                if (endWith("ator")) {
                    r("ate");
                    break;
                }
                break;
            case 's':
                if (endWith("alism")) {
                    r("al");
                    break;
                }
                if (endWith("iveness")) {
                    r("ive");
                    break;
                }
                if (endWith("fulness")) {
                    r("ful");
                    break;
                }
                if (endWith("ousness")) {
                    r("ous");
                    break;
                }
                break;
            case 't':
                if (endWith("aliti")) {
                    r("al");
                    break;
                }
                if (endWith("iviti")) {
                    r("ive");
                    break;
                }
                if (endWith("biliti")) {
                    r("ble");
                    break;
                }
                break;
            case 'g':
                if (endWith("logi")) {
                    r("log");
                    break;
                }
        }
    }
551372
def keys_with_suffix(self, suffix):
        
        return [k.rstrip(suffix) for k in self.keys() if k.endswith(suffix)]
522579
public void updateAfterInsert(Suffix<T, S> suffix) {
        if (activeNode == root && suffix.isEmpty()) {
            activeNode = root;
            activeEdge = null;
            activeLength = 0;
        } else if (activeNode == root) {
            Object item = suffix.getStart();
            activeEdge = root.getEdgeStarting(item);
            decrementLength();
            fixActiveEdgeAfterSuffixLink(suffix);
            if (activeLength == 0)
                activeEdge = null;
        } else if (activeNode.hasSuffixLink()) {
            activeNode = activeNode.getSuffixLink();
            findTrueActiveEdge();
            fixActiveEdgeAfterSuffixLink(suffix);
            if (activeLength == 0)
                activeEdge = null;
        } else {
            activeNode = root;
            findTrueActiveEdge();
            fixActiveEdgeAfterSuffixLink(suffix);
            if (activeLength == 0)
                activeEdge = null;
        }
    }
191709
private static int checkWildCard(final SearchableString value, final Literal suffix, final int start) {
        for (final int index : value.getIndices(suffix)) {
            if (index >= start) {
                return index;
            }
        }
        return -1;
    }
979876
def _clean_suffix(string, suffix):
    
    suffix_len = len(suffix)

    if len(string) < suffix_len:
        # the string param was shorter than the suffix
        raise ValueError("A suffix can not be bigger than string argument.")
    if string.endswith(suffix):
        # return from the beginning up to
        # but not including the first letter
        # in the suffix
        return string[0:-suffix_len]
    else:
        # leave unharmed
        return string
671388
private final void step4() {
        switch (b[k]) {
            case 'e':
                if (endWith("icate")) {
                    r("ic");
                    break;
                }
                if (endWith("ative")) {
                    r("");
                    break;
                }
                if (endWith("alize")) {
                    r("al");
                    break;
                }
                break;
            case 'i':
                if (endWith("iciti")) {
                    r("ic");
                    break;
                }
                break;
            case 'l':
                if (endWith("ical")) {
                    r("ic");
                    break;
                }
                if (endWith("ful")) {
                    r("");
                    break;
                }
                break;
            case 's':
                if (endWith("ness")) {
                    r("");
                    break;
                }
                break;
        }
    }
449131
public function step2()
    {
        if ( ($position = $this->searchIfInRv(array(
            'aríamos', 'eríamos', 'iríamos', 'ássemos', 'êssemos', 'íssemos',
            'aríeis', 'eríeis', 'iríeis', 'ásseis', 'ésseis', 'ísseis', 'áramos', 'éramos', 'íramos', 'ávamos',
            'aremos', 'eremos', 'iremos',
            'ariam', 'eriam', 'iriam', 'assem', 'essem', 'issem', 'arias', 'erias', 'irias', 'ardes', 'erdes', 'irdes',
            'asses', 'esses', 'isses', 'astes', 'estes', 'istes', 'áreis', 'areis', 'éreis', 'ereis', 'íreis', 'ireis',
            'áveis', 'íamos', 'armos', 'ermos', 'irmos',
            'aria', 'eria', 'iria', 'asse', 'esse', 'isse', 'aste', 'este', 'iste', 'arei', 'erei', 'irei', 'adas', 'idas',
            'aram', 'eram', 'iram', 'avam', 'arem', 'erem', 'irem', 'ando', 'endo', 'indo', 'ara~o', 'era~o', 'ira~o',
            'arás', 'aras', 'erás', 'eras', 'irás', 'avas', 'ares', 'eres', 'ires', 'íeis', 'ados', 'idos', 'ámos', 'amos',
            'emos', 'imos', 'iras',
            'ada', 'ida', 'ará', 'ara', 'erá', 'era', 'irá', 'ava', 'iam', 'ado', 'ido', 'ias', 'ais', 'eis', 'ira',
            'ia', 'ei', 'am', 'em', 'ar', 'er', 'ir', 'as', 'es', 'is', 'eu', 'iu', 'ou',
        ))) !== false) {

            $this->word = Utf8::substr($this->word, 0, $position);
            return true;
        }
        return false;
    }