Step 3: residual suffix
Search for the longest among the following suffixes in RV, and perform the action indicated.
969078
private function step3()
    {
        // os   a   o   á   í   ó
        //      delete if in RV
        if ( ($position = $this->searchIfInRv(array('os', 'a', 'o', 'á', 'í', 'ó'))) != false) {
            $this->word = Utf8::substr($this->word, 0, $position);
            return true;
        }

        // e   é
        //      delete if in RV, and if preceded by gu with the u in RV delete the u
        if ( ($position = $this->searchIfInRv(array('e', 'é'))) != false) {
            $this->word = Utf8::substr($this->word, 0, $position);

            if ( ($position2 = $this->searchIfInRv(array('u'))) != false) {
                $before = Utf8::substr($this->word, ($position2-1), 1);
                if ( (isset($before)) && ($before == 'g') ) {
                    $this->word = Utf8::substr($this->word, 0, $position2);
                    return true;
                }
            }
        }

        return false;
    }
1315594
private static String join(String prefix, String suffix) {
        int prefixLength = prefix.length();
        boolean haveSlash = (prefixLength > 0 && prefix.charAt(prefixLength - 1) == separatorChar);
        if (!haveSlash) {
            haveSlash = (suffix.length() > 0 && suffix.charAt(0) == separatorChar);
        }
        return haveSlash ? (prefix + suffix) : (prefix + separatorChar + suffix);
    }
520599
public boolean endsWith(String str, String suffix) {
        return (str == null || suffix == null) ? (str == suffix) :
            str.endsWith(suffix);
    }
1267190
def strip_required_suffix(string, suffix):
    
    if string.endswith(suffix):
        return string[:-len(suffix)]
    raise AssertionError('String ends with %r, not %r' % (string[-len(suffix):], suffix))
861601
def p_suffix(self, length=None, elipsis=False):
        ""
        if length is not None:
            result = self.input[self.pos:self.pos + length]
            if elipsis and len(result) == length:
                result += "..."
            return result
        return self.input[self.pos:]
445868
def exttype(suffix):
    """"""
    def inner(s):
        if s == '':
            return s
        first, last = os.path.splitext(s)
        return first + suffix
    return inner
208480
def strip_suffix(string, suffix):
    """"""
    if string.endswith(suffix):
        return string[:-(len(suffix))]
    return string
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
1272593
def step3(self):
        """"""
        if self.b[self.k] == 'e':
            if self.ends("icate"):     self.r("ic")
            elif self.ends("ative"):   self.r("")
            elif self.ends("alize"):   self.r("al")
        elif self.b[self.k] == 'i':
            if self.ends("iciti"):     self.r("ic")
        elif self.b[self.k] == 'l':
            if self.ends("ical"):      self.r("ic")
            elif self.ends("ful"):     self.r("")
        elif self.b[self.k] == 's':
            if self.ends("ness"):      self.r("")
1040213
def chunk_suffixes
      chunks.map { |chunk| File.extname(chunk).split("-").last }.sort
    end
989699
def regex_opt(strings, prefix='', suffix=''):
    
    strings = sorted(strings)
    return prefix + regex_opt_inner(strings, '(') + suffix
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;
    }
246142
def rdf_suffix(fmt: str) -> str:
    
    for k, v in SUFFIX_FORMAT_MAP.items():
        if fmt == v:
            return k
    return 'rdf'
253350
def suffix(self):
        """"""
        name = self.name
        i = name.rfind('.')
        if 0 < i < len(name) - 1:
            return name[i:]
        else:
            return ''
1267644
def __ensure_suffix(t, suffix):
    
    tpath = str(t)
    if not tpath.endswith(suffix):
        return tpath+suffix
    
    return t
423750
def search(self, searchString, category="", math=False, game=False, searchFiles=False, extension=""):
		""""""
		data = []
		nameData = {}
		fileData = {}
		
		#Search the name index
		if searchFiles:
			fileData = self.searchNamesIndex(self.fileIndex, fileData, searchString, category, math, game, extension, searchFiles)
		else:
			nameData = self.searchNamesIndex(self.nameIndex, nameData, searchString)
			
		#Now search the file index
		if searchFiles:
			nameData, fileData = self.searchFilesIndex(fileData, nameData, self.nameIndex, searchString)
		else:
			fileData, nameData = self.searchFilesIndex(nameData, fileData, self.fileIndex, searchString, category, math, game, extension)
			
		# Bail out if we failed to do either of those things.
		if fileData is None or nameData is None:
			self.repo.printd("Error: failed to load one or more of the index files for this repo. Exiting.")
			self.repo.printd("Please run 'calcpkg update' and retry this command.")
			sys.exit(1)
			
		# Prepare output to parse
		space = 0
		longestFile = len("File Name:")
		for key, value in nameData.iteritems():
			fileValue = fileData[key]
			data.append([fileValue, value])
			if not fileValue is None:
				folder = fileValue.rpartition("/")[0]
				if space < len(folder):
					space = len(folder)
			if not value is None:
				if longestFile < len(value):
					longestFile = len(value)

		#Print output
		space += 5
		if len(data) != 0:
			self.repo.printd("Results for repo: " + self.repo.name)
			self.repo.printd(structureOutput("File Category:", "File Name:", False, False, space))
			self.repo.printd("-" * (space + longestFile))
		else:
			self.repo.printd("No packages found")
		returnData = []
		for datum in data:
			try:
				self.repo.printd(structureOutput(datum[0], datum[1], searchFiles, True, space))
				returnData.append([datum[0], datum[1]])
			except:
				pass
		self.repo.printd(" ")
		
		#Return data
		return returnData
1228864
private function step3a()
    {
        if ($this->searchIfInRv(array('a', 'e', 'i', 'o', 'à', 'è', 'ì', 'ò')) !== false) {
            $this->word = Utf8::substr($this->word, 0, -1);

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