generate n-grams in order, return positions to caller