private double calculateColumnCountConsistency() {
            int max = -1;
            int totalRows = 0;
            //find the most common row
            for (Map.Entry<Integer, MutableInt> e : rowLengthCounts.entrySet()) {
                int numCols = e.getKey();
                int count = e.getValue().intValue();
                //require that numCols > 1 so that you had at least
                //one delimiter in that row
                if (numCols > 1 && count > max) {
                    max = count;
                }
                totalRows += count;
            }
            //if there's not enough info
            if (max < 0 || totalRows < 3) {
                return 0.0;
            }

            if (rowZeroEmpty) {
                // TIKA-4278: not credible that there would be no delimiter in row zero
                return 0.0;
            }

            //TODO: convert this to continuous vs vague heuristic step function
            double consistency = (double) max / (double) totalRows;
            return ((1d - (1d / Math.pow(totalRows, 0.3))) * consistency);
        }
@param reader
@param quoteCharacter
@return whether or not this was a correctly encapsulated cell
@throws UnsurprisingEOF if the file ended immediately after the close quote
@throws EOFException    if the file ended in the middle of the encapsulated section
@throws IOException     on other IOExceptions
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/csv/CSVSniffer.java