Wolfram Research

Function Repository Resource:

SynonymGraph

Source Notebook

Create a graph of a word's synonyms

Contributed by: Gustavo Delfino

ResourceFunction["SynonymGraph"]["word"]

creates a graphs of synonyms for the given English-language word.

ResourceFunction["SynonymGraph"]["word",n]

creates a graphs of synonyms for the given word, and recurses down n levels of synonyms.

Details and Options

ResourceFunction["SynonymGraph"]["word"] is equivalent to ResourceFunction["SynonymGraph"]["word",1]
ResourceFunction["SynonymGraph"] takes the same options as Graph.

Examples

Basic Examples

These are the synonyms of the word "wood" and which synonyms are synonyms themselves:

In[1]:=
ResourceFunction["SynonymGraph"]["wood"]
Out[1]=

Go one level deeper:

In[2]:=
ResourceFunction["SynonymGraph"]["wood", 2]
Out[2]=

And another level deeper:

In[3]:=
ResourceFunction["SynonymGraph"]["wood", 3]
Out[3]=

Scope

With the default recurse level, the number of nodes matches the number of synonyms of the word plus one for the original word:

In[4]:=
VertexList@ResourceFunction["SynonymGraph"]["sand"]
Out[4]=
In[5]:=
Synonyms["sand"]
Out[5]=

By increasing the recurse level, we get to see additional synonyms not directly related to the original word:

In[6]:=
ResourceFunction["SynonymGraph"]["sand", 2]
Out[6]=

All Graph options can be used:

In[7]:=
ResourceFunction["SynonymGraph"]["options", VertexLabelStyle -> Red]
Out[7]=

Neat Examples

CommunityGraphPlot applied to the SynonymGraph of "example" can show an interesting pattern of three communities.

In[8]:=
ResourceFunction["SynonymGraph"]["example"] // CommunityGraphPlot
Out[8]=

Resource History

Related Resources

License Information