pronounceable.js
function trainTuples(words) {
  var probs = {};
  var count = 0;

  words.forEach(function(w) {
    w = clean(w);

    for (var i = 0; i < w.length - 1; i++) {
      if (!probs[w[i]]) probs[w[i]] = {};
      if (!probs[w[i]][w[i + 1]]) probs[w[i]][w[i + 1]] = 1;
      else probs[w[i]][w[i + 1]]++;
      count++;
    }
  });

  Object.keys(probs).forEach(function(first) {
    Object.keys(probs[first]).forEach(function(second) {
      probs[first][second] = percent(probs[first][second], count);
    });
  });

  return probs;
}
function trainTuples(words) {
  var probs = {};
  var count = 0;

  words.forEach(function(w) {
    w = clean(w);

    for (var i = 0; i < w.length - 1; i++) {
      if (!probs[w[i]]) probs[w[i]] = {};
      if (!probs[w[i]][w[i + 1]]) probs[w[i]][w[i + 1]] = 1;
      else probs[w[i]][w[i + 1]]++;
      count++;
    }
  });

  Object.keys(probs).forEach(function(first) {
    Object.keys(probs[first]).forEach(function(second) {
      probs[first][second] = percent(probs[first][second], count);
    });
  });

  return probs;
}
function trainTuples ( words ) { var probs = { } ; var count = 0 ; words . forEach ( function ( w ) { w = clean ( w ) ; for ( var i = 0 ; i < w . length - 1 ; i ++ ) { if ( ! probs [ w [ i ] ] ) probs [ w [ i ] ] = { } ; if ( ! probs [ w [ i ] ] [ w [ i + 1 ] ] ) probs [ w [ i ] ] [ w [ i + 1 ] ] = 1 ; else probs [ w [ i ] ] [ w [ i + 1 ] ] ++ ; count ++ ; } } ) ; Object . keys ( probs ) . forEach ( function ( first ) { Object . keys ( probs [ first ] ) . forEach ( function ( second ) { probs [ first ] [ second ] = percent ( probs [ first ] [ second ] , count ) ; } ) ; } ) ; return probs ; }
Extract probabilities of word t 	uple.
Extract probabilities of word t uple .