public final double similarity ( final String s1 , final String s2 ) { int [ ] mtp = matches ( s1 , s2 ) ; float m = mtp [ 0 ] ; if ( m == 0 ) { return 0f ; } double j = ( ( m / s1 . length ( ) + m / s2 . length ( ) + ( m - mtp [ 1 ] ) / m ) ) / THREE ; double jw = j ; if ( j > getThreshold ( ) ) { jw = j + Math . min ( JW_COEF , 1.0 / mtp [ THREE ] ) * mtp [ 2 ] * ( 1 - j ) ; } return jw ; }
Compute JW similarity .