adding write and read ngram tables