timpalpant / LittleBoxes

A crossword solver
GNU General Public License v3.0
1 stars 0 forks source link

Add simple N-gram model with Laplace smoothing #29

Open timpalpant opened 8 years ago

timpalpant commented 8 years ago

Estimates, for any sequence of N letters, the probability P( letters[-1] | letters[:-1] ).

Public interface includes two functions:

  1. p(ngram) -> return the N-gram probability.
  2. most_likely(prefix) -> return the most likely next letter for a prefix of (N-1) letters.

Code will need some cleanup but it's a start for #10.