Define a valid en-ending as a non-vowel, and not gem.
@param string $ending
@return boolean
540077
private function hasValidEnEnding($word)
    {
        $lastLetter = Utf8::substr($word, -1, 1);
        if (in_array($lastLetter, self::$vowels)) {
            return false;
        }

        $threeLastLetters = Utf8::substr($word, -3, 3);
        if ($threeLastLetters == 'gem') {
            return false;
        }
        return true;
    }
541393
private function findAllTextBetween($beginning, $end, $string) {
    $beginningPos = strpos($string, $beginning);
    $endPos = strpos($string, $end);
    if ($beginningPos === false || $endPos === false) {
      return '';
    }

    $textToDelete = substr($string, $beginningPos, ($endPos + strlen($end)) - $beginningPos);

    return $textToDelete;
  }
196457
protected function end()
    {
        if ($this->matchChar(';')) {
            return true;
        }

        if ($this->count === strlen($this->buffer) || $this->buffer[$this->count] === '}') {
            // if there is end of file or a closing block next then we don't need a ;
            return true;
        }

        return false;
    }
1115580
private function isEndToken()
    {
        return $this->tokenIs(';')
        || $this->tokenIs(',')
        || $this->tokenIs(')')
        || $this->tokenIs(']')
        || $this->tokenIs(T_DOUBLE_ARROW);
    }
649440
public function getEnd() : string
        {
                $value = $this->_redis->rpop($this->_key);
                return !empty($value)?$value:'';
        }
783621
public function subscriptionEndsAt($ends = null)
    {
        if ($ends === null) {
            return $this->subscription_ends_at;
        } else {
            $this->subscription_ends_at = $ends;
            return $this;
        }
    }
760838
protected function endsWithDynamic($function, $needle)
    {
        $enc = $this->getEncoding();
        $strlen = $this->length($enc);
        $testlen = mb_strlen($needle, $enc);

        if ($testlen <= $strlen)
        {
            return ($function($this->toString(), $needle, ($strlen-$testlen), $enc)!==false);
        }
        return false;
    }
1116115
public static function end()
	{
		$content = '';
		if (self::$open)
		{
			$content .= '</div></div>';
		}
		self::$open = false;
		$content .= '</div>';
		return $content;
	}
308795
public function takeAllAlphaNumUntil(string $ends): string
    {
        $ends = self::split($ends);

        $ends[] = "alphanumeric";

        $taken = "";

        while (ctype_alnum($this->peek())) {
            $char = $this->take();

            $taken .= $char;
        }

        $this->latestExpectations = $ends;

        if (!in_array($this->peek(), $ends)) {
            throw new UnexpectedChar($this, $ends);
        }

        return $taken;
    }
1371414
public function end()
    {
        $content = ob_get_clean();
        switch ($this->type) {
            case 'append' :
                $this->data[$this->name] .= $content;
                break;

            case 'prepend' :
                $this->data[$this->name] = $content . $this->data[$this->name];
                break;

            case 'set' :
                $this->data[$this->name] = $content;
        }
        return '';
    }
146060
protected function openString($end, &$out, $nestingOpen = null)
    {
        $oldWhite = $this->eatWhiteDefault;
        $this->eatWhiteDefault = false;

        $patt = '(.*?)([\'"]|#\{|' . $this->pregQuote($end) . '|' . static::$commentPattern . ')';

        $nestingLevel = 0;

        $content = [];

        while ($this->match($patt, $m, false)) {
            if (isset($m[1]) && $m[1] !== '') {
                $content[] = $m[1];

                if ($nestingOpen) {
                    $nestingLevel += substr_count($m[1], $nestingOpen);
                }
            }

            $tok = $m[2];

            $this->count-= strlen($tok);

            if ($tok === $end && ! $nestingLevel--) {
                break;
            }

            if (($tok === "'" || $tok === '"') && $this->string($str)) {
                $content[] = $str;
                continue;
            }

            if ($tok === '#{' && $this->interpolation($inter)) {
                $content[] = $inter;
                continue;
            }

            $content[] = $tok;
            $this->count+= strlen($tok);
        }

        $this->eatWhiteDefault = $oldWhite;

        if (!$content) {
            return false;
        }

        // trim the end
        if (is_string(end($content))) {
            $content[count($content) - 1] = rtrim(end($content));
        }

        $out = [Type::T_STRING, '', $content];

        return true;
    }
667037
protected function strEndsWith($str, $end)
    {
        return substr_compare($str, $end, -strlen($end), strlen($end)) === 0;
    }
588181
public function endsWith($suffix) {
		$other = new Str($suffix, $this->charset);

		return mb_strrpos($this->rawString, $suffix, 0, $this->charset) === ($this->length() - $other->length());
	}
119218
function abs_end(){
		$Node = $this;
		while( $Child = end( $Node->children ) ){
			$Node = $Child;
		}
		return $Node;
	}
373537
public function wrap($content, $end = ';', $newLine = false)
    {
        return  '<?php ' . $content . $end . ' ?>' . ($newLine === true ? PHP_EOL : '');
    }
62073
public function readUntil($end)
    {
        if (empty($end)) {
            throw new ResourceException("Empty string given to Reader::readUntil()");
        }
        fseek($this->resource, $this->readPosition);
        // Reading the first character (maybe blocking)
        $buffer = stream_get_contents($this->resource, 1);
        // saving the blocking mode
        $mode = $this->blocking();
        $size = strlen($end);
        $this->blocking(false);
        while (strlen($buffer) < $size || substr($buffer, -$size) != $end) {
            $c = stream_get_contents($this->resource, 1);
            if (empty($c)) {
                break;
            }
            $buffer .= $c;
        }
        $this->blocking($mode);
        $this->readPosition = ftell($this->resource);
        return (substr($buffer, -$size) == $end)
            ? substr($buffer, 0, strlen($buffer) - $size)
            : $buffer;
    }
850718
def matchremove_noun_endings(word):
    """"""

    was_stemmed = False

    """common and proper noun and adjective word endings sorted by charlen, then alph"""
    noun_endings = ['arons', 'ains', 'aron', 'ment', 'ain', 'age', 'on', 'es', 'ée', 'ee', 'ie', 's']

    for ending in noun_endings:
        """ignore exceptions"""
        if word in exceptions:
            word = word
            was_stemmed = True
            break
        if word == ending:
            word = word
            was_stemmed = True
            break
        """removes noun endings"""
        if word.endswith(ending):
            word = re.sub(r'{0}$'.format(ending), '', word)
            was_stemmed = True
            break

    return word, was_stemmed