moved ngram functions back to seperate file