It is clear that the smaller the average within-class distance or the average between-class distance, the larger the within-segment word similarity or the between-segment word similarity, and vice versa.
we want to find the best segmentation of a document in which within-segment word similarity is the largest, and between-segment word similarity is the smallest.