Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find words associated with a search term in a list, text file, PDF or URL
ResourceFunction["ConcordanceWords"][source,searchterm,n] finds surrounding words within n words of searchterm in source. |
"file" | a file or URL corresponding to a PDF file |
{"string1","string2",…} | a list of strings of text content |
Find words occurring next to or near "president" in the US Constitution:
In[1]:= | ![]() |
Out[1]= | ![]() |
Find words occurring next to or near "Earth" on Wikipedia's page on the Moon:
In[2]:= | ![]() |
Out[2]= | ![]() |
Find words occurring next to or near "analytics" in a PDF published online:
In[3]:= | ![]() |
Out[3]= | ![]() |
Specify a distance of 5 for words occurring next to "Sheet" on Wikipedia's page on "Paper":
In[4]:= | ![]() |
Out[4]= | ![]() |
Find words occurring next to or near "circle" on a webpage using its URL:
In[5]:= | ![]() |
In[6]:= | ![]() |
Out[6]= | ![]() |
Specify a distance of 5:
In[7]:= | ![]() |
Out[7]= | ![]() |
The web scraping function will only work if it matches the XML element condition:
In[8]:= | ![]() |
Out[8]= | ![]() |
Instead, the following code can be used to import and process the data:
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
In[11]:= | ![]() |
Out[11]= | ![]() |
Find correlated words using ServiceConnect["ArXiv"]:
In[12]:= | ![]() |
In[13]:= | ![]() |
Out[13]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License