public function similarity(&$A, &$B)
    {
        $alpha = $this->alpha;
        $beta = $this->beta;

        $a = array_fill_keys($A,1);
        $b = array_fill_keys($B,1);

        $min = min(count(array_diff_key($a,$b)),count(array_diff_key($b, $a)));
        $max = max(count(array_diff_key($a,$b)),count(array_diff_key($b, $a)));

        $intersect = count(array_intersect_key($a,$b));

        return $intersect/($intersect + ($beta * ($alpha * $min + $max*(1-$alpha)) ));
    }
public function similarity(&$A, &$B)
    {
        $alpha = $this->alpha;
        $beta = $this->beta;

        $a = array_fill_keys($A,1);
        $b = array_fill_keys($B,1);

        $min = min(count(array_diff_key($a,$b)),count(array_diff_key($b, $a)));
        $max = max(count(array_diff_key($a,$b)),count(array_diff_key($b, $a)));

        $intersect = count(array_intersect_key($a,$b));

        return $intersect/($intersect + ($beta * ($alpha * $min + $max*(1-$alpha)) ));
    }
public function similarity ( & $ A , & $ B ) { $ alpha = $ this -> alpha ; $ beta = $ this -> beta ; $ a = array_fill_keys ( $ A , 1 ) ; $ b = array_fill_keys ( $ B , 1 ) ; $ min = min ( count ( array_diff_key ( $ a , $ b ) ) , count ( array_diff_key ( $ b , $ a ) ) ) ; $ max = max ( count ( array_diff_key ( $ a , $ b ) ) , count ( array_diff_key ( $ b , $ a ) ) ) ; $ intersect = count ( array_intersect_key ( $ a , $ b ) ) ; return $ intersect / ( $ intersect + ( $ beta * ( $ alpha * $ min + $ max * ( 1 - $ alpha ) ) ) ) ; }
Compute the similarity using the alpha and beta values given in the
constructor.

@param  array $A
@param  array $B
@return float
Compute the similarity using the alpha and beta values given in the constructor .