Function Repository Resource:

WordDefinitionLookup

Source Notebook

Find a list of words whose definitions include the given word

Contributed by: Gustavo Delfino

ResourceFunction["WordDefinitionLookup"]["word"]

returns a list of words whose WordDefinition includes "word".

Details and Options

The "word" can be a string representing a word, word fragment, multiple words or a string expression.
ResourceFunction["WordDefinitionLookup"] can be useful for finding related words.
Due to its CPU intensive nature, memoization is used.
ResourceFunction["WordDefinitionLookup"] takes the option MaxItems, which limits the number of words returned by favoring the ones that appear more times in the definition.
ResourceFunction["WordDefinitionLookup"] can return a long list of words leading to long execution times, especially in nested applications. Using the MaxItems option helps avoid this issue.

Examples

Basic Examples (1) 

List of words that include "coffee" in their definition:

In[1]:=
ResourceFunction["WordDefinitionLookup"]["coffee"]
Out[1]=

Scope (3) 

One word lookup:

In[2]:=
ResourceFunction["WordDefinitionLookup"]["mathematics"]
Out[2]=

More than one word:

In[3]:=
ResourceFunction["WordDefinitionLookup"]["very fast"]
Out[3]=

A string expression can be given as input:

In[4]:=
ResourceFunction["WordDefinitionLookup"][WordBoundary ~~ "mega"]
Out[4]=

Check the definition of one of these results:

In[5]:=
WordDefinition["dolmen"]
Out[5]=

Options (2) 

MaxItems (2) 

Use MaxItems to limit the number of results returned:

In[6]:=
ResourceFunction["WordDefinitionLookup"]["and", MaxItems -> 10]
Out[6]=

The result is sorted according to the number of times that the search term appears:

In[7]:=
ResourceFunction[
ResourceObject[<|"Name" -> "HighlightText", "ShortName" -> "HighlightText", "UUID" -> "76533b3c-29f2-4450-8ffa-cd4ba05a1a02", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Highlight parts of text according to a given pattern", "RepositoryLocation" -> URL[
     "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$d7deb5e4d45a4b9880fe6a5f5c231486`HighlightText", "FunctionLocation" -> CloudObject[
     "https://www.wolframcloud.com/obj/e2e460be-b05b-4e4a-9556-e1ea21a3e8de"]|>, ResourceSystemBase -> Automatic]][
 StringRiffle[WordDefinition["centime"], "\n"], WordBoundary ~~ "and" ~~ WordBoundary]
Out[7]=

Applications (4) 

When looking for the correct word to express an idea, sometimes the word definition and synonyms are not sufficient. WordDefinitionLookup makes a reverse dictionary lookup:

In[8]:=
Synonyms["disappoint"]
Out[8]=
In[9]:=
ResourceFunction["WordDefinitionLookup"]["disappoint"]
Out[9]=

Create a graph where each found word relates to the input word:

In[10]:=
Graph[Thread[ ResourceFunction[
      "WordDefinitionLookup"][#] \[UndirectedEdge] #] &["wolf"], VertexLabels -> "Name", ImageSize -> Large]
Out[10]=

Show results graphically according to word frequency data:

In[11]:=
ResourceFunction["WordDefinitionLookup"]["election"] // AssociationMap[k |-> WordFrequencyData[k]] // ListLogPlot
Out[11]=

Create a nested graph of words contained in definitions of other words:

In[12]:=
NestGraph[ResourceFunction["WordDefinitionLookup"], "socialism", 3, VertexLabels -> "Name", ImageSize -> Large]
Out[12]=

Properties and Relations (2) 

WordDefinitionLookup complements the words returned by Synonyms:

In[13]:=
Synonyms["wood"]
Out[13]=
In[14]:=
ResourceFunction["WordDefinitionLookup"]["wood"]
Out[14]=

The resource function SynonymGraph is also useful for finding words:

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

Neat Examples (1) 

For maximum word-searching power we can combine WordDefinitionLookup, Synonyms and NestGraph:

In[16]:=
NestGraph[{ResourceFunction["WordDefinitionLookup"], Synonyms}/*
  Through/*Flatten, "ethanol", 3, VertexLabels -> "Name", ImageSize -> Large]
Out[16]=

Possible Issues (1) 

Word definition lookups are case sensitive:

In[17]:=
ResourceFunction["WordDefinitionLookup"]["roman"]
Out[17]=
In[18]:=
ResourceFunction["WordDefinitionLookup"]["Roman"]
Out[18]=

Publisher

GustavoDelfino

Version History

  • 1.0.0 – 08 July 2022

Related Resources

License Information