src/edu/kit/informatik/Utilities.java
/**
     * Calculates the jaccard factor of two collections of words.
     * The calculation method is describe in the first final assignment, command C14
     * @param firstGroupWords a collection of words
     * @param secondGroupWords another collection of words
     * @return the jaccard factor of the two given collections
     */
Calculates the jaccard factor of two collections of words.
The calculation method is describe in the first final assignment, command C14
@param firstGroupWords a collection of words
@param secondGroupWords another collection of words
@return the jaccard factor of the two given collections
Calculates the jaccard factor of two collections of words . The calculation method is describe in the first final assignment command C14 @param firstGroupWords a collection of words @param secondGroupWords another collection of words @return the jaccard factor of the two given collections
public static float jaccard(
            final Collection<String> firstGroupWords, final Collection<String> secondGroupWords) {
        Objects.requireNonNull(firstGroupWords);
        Objects.requireNonNull(secondGroupWords);
        Collection<String> union = Utilities.unifyNoRepetition(firstGroupWords, secondGroupWords);
        if (union.size() == 0)
            return 1;
        Collection<String> intersection = Utilities.intersectMultipleRetain(firstGroupWords, secondGroupWords);
        return ((float) intersection.size()) / union.size();
    }
public static float jaccard ( final Collection < String > firstGroupWords , final Collection < String > secondGroupWords ) { Objects . requireNonNull ( firstGroupWords ) ; Objects . requireNonNull ( secondGroupWords ) ; Collection < String > union = Utilities . unifyNoRepetition ( firstGroupWords , secondGroupWords ) ; if ( union . size ( ) == 0 ) return 1 ; Collection < String > intersection = Utilities . intersectMultipleRetain ( firstGroupWords , secondGroupWords ) ; return ( ( float ) intersection . size ( ) ) / union . size ( ) ; }
Calculates the jaccard factor of two collections of words.
Calculates the jaccard factor of two collections of words .
// FIXME filter repeated in collections before calculations? // If the unified collections have no elements // FIXME re factor to improved intersect