fixes bug with looping over top n when n is larger than the number of terms in a patent's text