src/main/java/eu/digitisation/ngram/NgramModel.java
protected double prob(String s) {
        double result;
        if (s.charAt(0) == BOS) {
            result = occurrences(String.valueOf(BOS) + lastChar(s))
                    / (double) sampleSize();
        } else if (!occur.containsKey(s)) {
            result = 0;
        } else {
            result = occurrences(s) / (double) occurrences(head(s));
        }
        return result;
    }
/**
     * @param s a non-empty string
     * @return the conditional probability of the string relative to the
     * probability of its head.
     */
@param s a non-empty string
@return the conditional probability of the string relative to the
probability of its head.
@param s a non - empty string @return the conditional probability of the string relative to the probability of its head .
protected double prob(String s) {
        double result;
        if (s.charAt(0) == BOS) {
            result = occurrences(String.valueOf(BOS) + lastChar(s))
                    / (double) sampleSize();
        } else if (!occur.containsKey(s)) {
            result = 0;
        } else {
            result = occurrences(s) / (double) occurrences(head(s));
        }
        return result;
    }
protected double prob ( String s ) { double result ; if ( s . charAt ( 0 ) == BOS ) { result = occurrences ( String . valueOf ( BOS ) + lastChar ( s ) ) / ( double ) sampleSize ( ) ; } else if ( ! occur . containsKey ( s ) ) { result = 0 ; } else { result = occurrences ( s ) / ( double ) occurrences ( head ( s ) ) ; } return result ; }
@param s a non-empty string
 @return the conditional probability of the string relative to the
 probability of its head.
@param s a non - empty string @return the conditional probability of the string relative to the probability of its head .