double getConfidence() {
            double confidence = 0.0f;

            if (parseException) {
                return -1.0f;
            }
            //TODO -- add tests for long tokens containing
            //other delimiters, e.g. the,quick,brown,fox as a token
            //when testing '\t'
            double colCountConsistencyConf = calculateColumnCountConsistency();
            if (colCountConsistencyConf > -1.0) {
                confidence = colCountConsistencyConf;
            }
            //the idea is that if there are a bunch of encapsulated
            //cells, then that should outweigh column length inconsistency
            //this particular formula offers a small initial increase
            //that eventually approaches 1.0
            double encapsulatedBonus = 0;
            if (encapsulated > 0) {
                encapsulatedBonus = 1.0 - (1.0d / Math.pow(encapsulated, 0.2));
            }
            return Math.min(confidence + encapsulatedBonus, 1.0);
        }
@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