public function getMaximalDistance()
    {
        $oneSize = mb_strlen($this->compOne, 'UTF-8');
        $twoSize = mb_strlen($this->compTwo, 'UTF-8');

        // Is substitution cheaper that delete + insert?
        $subCost = min($this->subCost, $this->delCost + $this->insCost);

        // Get common size
        $minSize = min($oneSize, $twoSize);
        $maxSize = max($oneSize, $twoSize);
        $extraSize = $maxSize - $minSize;

        // On common size perform substitution / delete + insert, what is cheaper
        $maxCost = $subCost * $minSize;

        // On resulting do insert/delete
        if ($oneSize > $twoSize) {
            // Delete extra characters
            $maxCost += $extraSize * $this->delCost;
        } else {
            // Insert extra characters
            $maxCost += $extraSize * $this->insCost;
        }

        return $maxCost;
    }
public function getMaximalDistance()
    {
        $oneSize = mb_strlen($this->compOne, 'UTF-8');
        $twoSize = mb_strlen($this->compTwo, 'UTF-8');

        // Is substitution cheaper that delete + insert?
        $subCost = min($this->subCost, $this->delCost + $this->insCost);

        // Get common size
        $minSize = min($oneSize, $twoSize);
        $maxSize = max($oneSize, $twoSize);
        $extraSize = $maxSize - $minSize;

        // On common size perform substitution / delete + insert, what is cheaper
        $maxCost = $subCost * $minSize;

        // On resulting do insert/delete
        if ($oneSize > $twoSize) {
            // Delete extra characters
            $maxCost += $extraSize * $this->delCost;
        } else {
            // Insert extra characters
            $maxCost += $extraSize * $this->insCost;
        }

        return $maxCost;
    }
public function getMaximalDistance ( ) { $ oneSize = mb_strlen ( $ this -> compOne , 'UTF-8' ) ; $ twoSize = mb_strlen ( $ this -> compTwo , 'UTF-8' ) ; // Is substitution cheaper that delete + insert? $ subCost = min ( $ this -> subCost , $ this -> delCost + $ this -> insCost ) ; // Get common size $ minSize = min ( $ oneSize , $ twoSize ) ; $ maxSize = max ( $ oneSize , $ twoSize ) ; $ extraSize = $ maxSize - $ minSize ; // On common size perform substitution / delete + insert, what is cheaper $ maxCost = $ subCost * $ minSize ; // On resulting do insert/delete if ( $ oneSize > $ twoSize ) { // Delete extra characters $ maxCost += $ extraSize * $ this -> delCost ; } else { // Insert extra characters $ maxCost += $ extraSize * $ this -> insCost ; } return $ maxCost ; }
Returns maximal possible edit Damerau Levenshtein distance between texts.

On common substring of same length perform substitution / insert + delete
(depends on what is cheaper), then on extra characters perform insertion / deletion

@return int
Returns maximal possible edit Damerau Levenshtein distance between texts .