main n-gram class