Semantic distance between excerpts of text.
You are looking for "lexical cohesion". Try searching for this term and you will get tons of literature. After constructing the so-called "lexical chains", well-known graph partitioning and information retrieval algorithms can be used to group them into semantic classes. There is in fact a lot of theory and algorithms behind this "post-processing". Dictionary of synonyms and antonyms is often used to construct these chains. I worked on such extraction algorithms during my undergraduate days, about 10 years back. So this field must be more advanced now.