Fixed ngrams(), score(), and frequency(). Put main code in __main__.

ngrams() was returning duplicate ngrams and sometimes too many.
score() was adding the log of partial sums, not individual frequencies
frequency() was returning > 0 for the empty sentence