src/tokenizers/sentences/punkt.js
function colLogLikelihood(a, b, ab, N) {
  const p = b / N,
        p1 = ab / a,
        p2 = (b - ab) / (N - a);

  const summand1 = ab * Math.log(p) + (a - ab) * Math.log(1 - p),
        summand2 = (b - ab) * Math.log(p) + (N - a - b + ab) * Math.log(1 - p);

  let summand3 = 0;
  if (a !== ab)
    summand3 = ab * Math.log(p1) + (a - ab) * Math.log(1 - p1);

  let summand4 = 0;
  if (b !== ab)
    summand4 = (b - ab) * Math.log(p2) + (N - a - b + ab) * Math.log(1 - p2);

  const likelihood = summand1 + summand2 - summand3 - summand4;

  return (-2 * likelihood);
}
function colLogLikelihood(a, b, ab, N) {
  const p = b / N,
        p1 = ab / a,
        p2 = (b - ab) / (N - a);

  const summand1 = ab * Math.log(p) + (a - ab) * Math.log(1 - p),
        summand2 = (b - ab) * Math.log(p) + (N - a - b + ab) * Math.log(1 - p);

  let summand3 = 0;
  if (a !== ab)
    summand3 = ab * Math.log(p1) + (a - ab) * Math.log(1 - p1);

  let summand4 = 0;
  if (b !== ab)
    summand4 = (b - ab) * Math.log(p2) + (N - a - b + ab) * Math.log(1 - p2);

  const likelihood = summand1 + summand2 - summand3 - summand4;

  return (-2 * likelihood);
}
function colLogLikelihood ( a , b , ab , N ) { const p = b / N , p1 = ab / a , p2 = ( b - ab ) / ( N - a ) ; const summand1 = ab * Math . log ( p ) + ( a - ab ) * Math . log ( 1 - p ) , summand2 = ( b - ab ) * Math . log ( p ) + ( N - a - b + ab ) * Math . log ( 1 - p ) ; let summand3 = 0 ; if ( a !== ab ) summand3 = ab * Math . log ( p1 ) + ( a - ab ) * Math . log ( 1 - p1 ) ; let summand4 = 0 ; if ( b !== ab ) summand4 = ( b - ab ) * Math . log ( p2 ) + ( N - a - b + ab ) * Math . log ( 1 - p2 ) ; const likelihood = summand1 + summand2 - summand3 - summand4 ; return ( - 2 * likelihood ) ; }
A function that wil just compute log-likelihood estimate, in the original
paper, it's described in algorithm 6 and 7.

Note: this SHOULD be the original Dunning log-likelihood values.

@param {number} a  - Count of <a>.
@param {number} b  - Count of <b>.
@param {number} ab - Count of <ab>.
@param {number} N  - Number of elements in the distribution.
@return {number}   - The log-likelihood.
A function that wil just compute log - likelihood estimate in the original paper it s described in algorithm 6 and 7 .