Add function to pick synonyms based on shortest path