N-gram generator working