static double evaluateRaw(boolean isCaseSensitive,
                              boolean tokenize,
                              String term,
                              String text,
                              String wordSeparatorCharacterRE,
                              LOCAL_TERM_WEIGHTS localTermWeights,
                              COUNT_HITS countHits,
                              LevenshteinDistance levenshteinDistance) {
        if (!isCaseSensitive) {
            term = term.toLowerCase();
            text = text.toLowerCase();
        }
        Pattern pattern = tokenize ? Pattern.compile(wordSeparatorCharacterRE) : Pattern.compile(DEFAULT_TOKENIZER);
        List<String> terms = splitText(term, pattern);
        List<String> texts = splitText(text, pattern);
        int calculatedLevenshteinDistance;
        switch (countHits) {
            case ALL_HITS:
                calculatedLevenshteinDistance = evaluateLevenshteinDistanceAllHits(levenshteinDistance, terms, texts);
                break;
            case BEST_HITS:
                calculatedLevenshteinDistance = evaluateLevenshteinDistanceBestHits(levenshteinDistance, terms, texts);
                break;
            default:
                throw new IllegalArgumentException("Unknown COUNT_HITS " + countHits);
        }
        switch (localTermWeights) {
            case TERM_FREQUENCY:
                return calculatedLevenshteinDistance;
            case BINARY:
                return evaluateBinary(calculatedLevenshteinDistance);
            case LOGARITHMIC:
                return evaluateLogarithmic(calculatedLevenshteinDistance);
            case AUGMENTED_NORMALIZED_TERM_FREQUENCY:
                return evaluateAugmentedNormalizedTermFrequency(calculatedLevenshteinDistance, texts);
            default:
                throw new IllegalArgumentException("Unknown LOCAL_TERM_WEIGHTS " + localTermWeights);
        }
    }
@Test
    void evaluateRawNoTokenize() {
        LevenshteinDistance levenshteinDistance = new LevenshteinDistance(2);
        Map<LOCAL_TERM_WEIGHTS, Double> expectedResults = new HashMap<>();
        double frequency = 3.0;
        double logarithmic = Math.log10(1 + frequency);
        int maxFrequency = 2;
        double augmentedNormalizedTermFrequency = 0.5 * (1 + (frequency / (double) maxFrequency)); // cast
        // for java:S2184
        expectedResults.put(TERM_FREQUENCY, frequency);
        expectedResults.put(BINARY, 1.0);
        expectedResults.put(LOGARITHMIC, logarithmic);
        expectedResults.put(AUGMENTED_NORMALIZED_TERM_FREQUENCY, augmentedNormalizedTermFrequency);
        expectedResults.forEach((localTermWeights, expected) -> {
            double evaluateRaw = KiePMMLTextIndex.evaluateRaw(true,
                                                              false,
                                                              TERM_0,
                                                              TEXT_0,
                                                              "\\s+",
                                                              localTermWeights,
                                                              COUNT_HITS.ALL_HITS,
                                                              levenshteinDistance);
            assertThat(evaluateRaw).isCloseTo(expected, Offset.offset(0.0000001));
        });
        //---
        maxFrequency = 3;
        augmentedNormalizedTermFrequency = 0.5 * (1 + (frequency / (double) maxFrequency)); // cast
        // for java:S2184
        expectedResults = new HashMap<>();
        expectedResults.put(TERM_FREQUENCY, frequency);
        expectedResults.put(BINARY, 1.0);
        expectedResults.put(LOGARITHMIC, logarithmic);
        expectedResults.put(AUGMENTED_NORMALIZED_TERM_FREQUENCY, augmentedNormalizedTermFrequency);
        expectedResults.forEach((localTermWeights, expected) -> {
            double evaluateRaw = KiePMMLTextIndex.evaluateRaw(false,
                                                              false,
                                                              TERM_0,
                                                              TEXT_0,
                                                              "\\s+",
                                                              localTermWeights,
                                                              COUNT_HITS.ALL_HITS,
                                                              levenshteinDistance);
            assertThat(evaluateRaw).isCloseTo(expected, Offset.offset(0.0000001));
        });
        //---
        frequency = 3.0;
        logarithmic = Math.log10(1 + frequency);
        augmentedNormalizedTermFrequency = 0.5 * (1 + (frequency / (double) maxFrequency)); // cast
        // for java:S2184
        expectedResults = new HashMap<>();
        expectedResults.put(TERM_FREQUENCY, frequency);
        expectedResults.put(BINARY, 1.0);
        expectedResults.put(LOGARITHMIC, logarithmic);
        expectedResults.put(AUGMENTED_NORMALIZED_TERM_FREQUENCY, augmentedNormalizedTermFrequency);
        expectedResults.forEach((localTermWeights, expected) -> {
            double evaluateRaw = KiePMMLTextIndex.evaluateRaw(false,
                                                              false,
                                                              TERM_0,
                                                              TEXT_0,
                                                              "[\\s\\-]",
                                                              localTermWeights,
                                                              COUNT_HITS.ALL_HITS,
                                                              levenshteinDistance);
            assertThat(evaluateRaw).isCloseTo(expected, Offset.offset(0.0000001));
        });
    }