home << dhlab reference << dhlab.api.dhlab_api

ngram_news#

from dhlab.api.dhlab_api import ngram_news
ngram_news(word=['.'], title=None, period=None)[source]#

Get a time series of frequency counts for word in newspapers.

Call the API BASE_URL endpoint /ngram_newspapers.

Parameters:
  • word (str or list of str) – Word(s) to search for. Can be several words in a single string, separated by comma, e.g. "ord,ordene,orda".

  • title (str) – Title of a specific newspaper to search through.

  • period (tuple of ints) – Start and end years or dates of a time period, given as (YYYY, YYYY) or (YYYYMMDD, YYYYMMDD).

Returns:

a pandas.DataFrame with the resulting frequency counts of the word(s), spread across the dates given in the time period. Either one year or one day per row.

Return type:

DataFrame