added read_text() and calc_ngrams() functions