public double distance ( Synset synset1 , Synset synset2 ) { Preconditions . checkNotNull ( synset1 ) ; Preconditions . checkNotNull ( synset2 ) ; if ( synset1 . equals ( synset2 ) ) { return 0d ; } List < Synset > path = shortestPath ( synset1 , synset2 ) ; return path . isEmpty ( ) ? Double . POSITIVE_INFINITY : path . size ( ) - 1 ; }
Calculates the distance between synsets .