finally working method, for now only for position n-grams