Sorting synonyms

Example query recieved by email:

Need a more convoluted way to say something’s convoluted?
synonyms convoluted:
synonyms convoluted - Wolfram|Alpha

Suppose I’m composing a tweet, the most useful synonym for a word would be the shortest. How do I sort the results by length? So far I’ve figured out that “character count” will tell me the length of an input string, but I haven’t figured out how to apply it to the results list of “synonyms convoluted”.

Here is a solution:

synonyms[word_] := Module[
   {wordData , likeTypes},
   wordData = WordData[word, "Synonyms"];
   If[ Head[wordData] == WordData, Return[{word}]];
   (*Print[wordData];*)
   likeTypes = Flatten[Last /@ wordData];
   If[Length[likeTypes] == 0 , Return[{word}]];
   Union@likeTypes
   ] /; StringQ[word]

try this:
synonyms[“face”]

or

synonyms[word_, type_] := Module[
   {wordData = WordData[word, "Synonyms"], likeTypes},
   likeTypes = 
    Union@Flatten[
      Last /@ Select[wordData, MemberQ[First[#], type] &]]
   ] /; StringQ[word] && StringQ[type]

Then try,
synonyms[“face”, “Verb”]

so your shortest solutions would be something like this:

SortBy[synonyms["convoluted", "Adjective"], StringLength]

SortBy[synonyms["convoluted"], StringLength]

SortBy[synonyms["convoluted", "Noun"], StringLength]

or

First[SortBy[synonyms["convoluted", "Adjective"], StringLength]]

There is also a nice example in documentation. It has combinatorial nature so I would not use it for too many words - you will need more time then.

Find the shortest versions of a phrase based on synonyms for its constituent words:

In

text = StringSplit["operational fracture conceptualization"]

Out

{"operational", "fracture", "conceptualization"}

In

Take[SortBy[StringJoin[Riffle[#, " "]] & /@ 
   Tuples[WordData[#, "Synonyms", "List"] & /@ text], StringLength],3]

Out

{"usable break formulation", "usable crack formulation", "usable fault formulation"}

You’ve inspired me to write this: Fit it and tweet it - optimized reflections on Einstein and Chinese poems