CSVResult getBest(Reader reader, Metadata metadata) throws IOException {
        //TODO: take into consideration the filename.  Perhaps require
        //a higher confidence if detection contradicts filename?
        List<CSVResult> results = sniff(reader);
        if (results == null || results.isEmpty()) {
            return CSVResult.TEXT;
        }
        CSVResult bestResult = results.get(0);
        if (bestResult.getConfidence() < minConfidence) {
            return CSVResult.TEXT;
        }
        // TIKA-4278: colon isn't reliable, e.g. govdocs1/242/242970.txt
        if (results.size() > 1 && bestResult.getDelimiter().equals(':') &&
                Math.abs(results.get(1).getConfidence() - bestResult.getConfidence()) < 0.0001) {
            return results.get(1);
        }
        return bestResult;
    }
@param reader
@param metadata
@return the best result given the detection results or {@link CSVResult#TEXT}
if the confidence is not above a threshold.
@throws IOException
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/csv/CSVSniffer.java