generating vectors from n-grams