some updates to ngrams.R as per Kens notes