class RootTermDistanceCalculator {

    public int calculateMinimalDistance(String stringToMatch) {
        var lowerCaseStringToMatch = stringToMatch.toLowerCase();
        var mergedSet = mergeRootTermAndDerivedTerms();
        boolean matchesRootTermOrDerivedTerm = mergedSet.contains(lowerCaseStringToMatch);

        if(matchesRootTermOrDerivedTerm) {
            return 0;
        }

        return mergedSet.parallelStream()
                .mapToInt(term -> calculateLevenshteinDistance(term, lowerCaseStringToMatch))
                .min()
                .orElse(0);
    }

    public  RootTermDistanceCalculator(String rootTerm, Set<String> derivedTerms);

}