start_key = ''
sentence = mod_hash[start_key].sample
#=> "The tonight."
We now simply replace each word in sentence that begins '<' and ends '>' with a randomly-selected element of the value of that key in mod_hash (the value being an array of strings). This continues until there are no more such words in sentence.
The question mark in the regex means that one or more characters are to be matched lazily. That means that the match is terminated as soon as the first '>' is encountered. If, for example, the sentence were "a and !", the regex would match both and . By contrast, if the match were greedy (the default), it would match " and ", which of course is not a key of mod_hash.
Note that hash could have a structure that results in a non-terminating sequence of replacements.