/**
 * Step 5
 *
 * @param string $word Word to stem
 */
function step5($word)
{
    // Part a
    if (substr($word, -1) == 'e') {
        if (m(substr($word, 0, -1)) > 1) {
            replace($word, 'e', '');
        } else {
            if (m(substr($word, 0, -1)) == 1) {
                if (!cvc(substr($word, 0, -1))) {
                    replace($word, 'e', '');
                }
            }
        }
    }
    // Part b
    if (m($word) > 1 and doubleConsonant($word) and substr($word, -1) == 'l') {
        $word = substr($word, 0, -1);
    }
    return $word;
}
Пример #2
0
function step5($word)
{
    if (substr($word, -1) == "e") {
        if (1 < m(substr($word, 0, -1))) {
            replace($word, "e", "");
        } else {
            if (m(substr($word, 0, -1)) == 1 && !cvc(substr($word, 0, -1))) {
                replace($word, "e", "");
            }
        }
    }
    if (1 < m($word) && doubleconsonant($word) && substr($word, -1) == "l") {
        $word = substr($word, 0, -1);
    }
    return $word;
}