helper function to shorten text by words.