Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Plot the density of keywords in a piece of text
ResourceFunction["KeywordPlot"][text,keywords] generates a plot of the keyword's density within the given text. | |
ResourceFunction["KeywordPlot"][keywords] represents an operator form of ResourceFunction["KeywordPlot"] that can be applied to any string. |
| "PlotFunction" | Automatic | specify which plotting function to use; currently only SmoothHistogram is supported |
| "TopN" | All | specify to plot only the top‐n most frequent keywords |
Plot the density of characters in a string:
| In[1]:= |
| Out[1]= | ![]() |
Plot the density of certain keywords in "Alice in Wonderland":
| In[2]:= | ![]() |
| Out[2]= | ![]() |
Plot character mentions through a play:
| In[3]:= | ![]() |
| In[4]:= | ![]() |
| Out[4]= | ![]() |
Plot the density of characters in a string:
| In[5]:= |
| Out[5]= | ![]() |
If a keyword is not found in the text, it is automatically dropped from the plot:
| In[6]:= |
| Out[6]= | ![]() |
Of course, if no keywords are found, the plot will fail:
| In[7]:= |
| Out[7]= |
If keyword densities are too low, the plots may be look strange and spikey, e.g. relatively rare Greek god mentions in the Latin poem Aeneid:
| In[8]:= | ![]() |
| In[9]:= |
| Out[9]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License