Words with Functions

Collect article text data and metadata, using a function oriented approach.

Function Approach: collect_words

The function for collecting words data is collect_words().

Given a list of search terms, this function handles all the requests to collect the data.

The parameters for collect_words are the same as described in the Words tutorial.

Here we will briefly explore collecting data directly using the function approach.

# Import the function to collect words data
from lisc.collect import collect_words
# Set some terms to search for
terms = [['brain'], ['body']]
# Collect words data, setting to collect data for at most 5 articles per term
results, meta_data = collect_words(terms, retmax=5, usehistory=False,
                                   save_and_clear=False, verbose=True)
Collecting data for:  brain
Collecting data for:  body
# The meta data includes some information on the database from which data was collected
meta_data['db_info']
{'dbname': 'pubmed', 'menuname': 'PubMed', 'description': 'PubMed bibliographic record', 'dbbuild': 'Build-2025.03.05.19.16', 'count': '38493853', 'lastupdate': '2025/03/05 19:16'}
# The collected data is returned as a list of Articles objects
print(results)
[<lisc.data.articles.Articles object at 0x7f85becbe700>, <lisc.data.articles.Articles object at 0x7f85becbe850>]
# Each `Articles` object holds the data for the collected articles for a given term
res1 = results[0]
# Print out some of the data
print(res1.n_articles, '\n')
print('\n'.join(res1.titles), '\n')
5

Biomarkers of Oxidative Stress, Inflammation, and Brain Damage in Mexican Women over 60 Years of Age with Obesity.
KNDy Neurons and the Control of the Gonadotropic Axis in the Midgestation Fetal Sheep.
Fetal malformations of cortical development: review and clinical guidance.
Phase II Trial of Pembrolizumab in Combination With Bevacizumab for Untreated Melanoma Brain Metastases.
Reader Response: Right Brain: The Unraveling.

To further explore the collected data, check out the documentation for the Articles object. To aggregate data across articles, check out the ArticlesAll object.

Total running time of the script: (0 minutes 2.577 seconds)

Gallery generated by Sphinx-Gallery