What is Google Ngram Viewer?

The Google Ngram Viewer is a search engine used to determine the popularity of a word or a phrase in books. Google ngram viewer gives us various filter options, including selecting the language/genre of the books (also called corpus) and the range of years in which the books were published. By default, the search is case-sensitive.  

What Does a Google Ngram Search Result Look Like?

If we search for “Albert Einstein” in Google Ngram, the search result will look like this.

 

A phrase having only one word (say “geek”), the phrase is called a unigram. Similarly, a phrase containing two words (say “Isaac Newton”) is called a bigram. If you search for a bigram phrase in google ngram, it will show you this: Of all the bigrams present in books, what percentage of them contained the phrase you searched for.

We can even compare the popularity of different phrases in the same search result by separating them with commas. For example, we can compare the popularity of “Albert Einstein” vs “Isaac Newton” from the years 1850 to 1900 across different books written in the English language.

Working With the Google Ngram URLs

If we search for “Albert Einstein” in google ngram with the years ranging from 1850 to 1860, corpus being English, and 0 smoothing, we will see a graph as shown in the image above. The URL of this search query will look like this.

https://books.google.com/ngrams/graph?content=Albert%20Einstein&year_start=1850&year_end=1860&corpus=26&smoothing=0

In the above URL, if we replace the word graph with the word json, we will get the JSON data of our search query instead of the graph. The new URL will look like this.

https://books.google.com/ngrams/json?content=Albert%20Einstein&year_start=1850&year_end=1860&corpus=26&smoothing=0

The search result of this URL will look like this:

 

We can extract this JSON data using Python.

Scrape Google Ngram Viewer using Python

In this article, we will learn how to scrape Google Ngarm using Python. Google Ngram/Google Books Ngram Viewer is an online search engine that charts the frequencies of any set of search strings.

Similar Reads

What is Google Ngram Viewer?

The Google Ngram Viewer is a search engine used to determine the popularity of a word or a phrase in books. Google ngram viewer gives us various filter options, including selecting the language/genre of the books (also called corpus) and the range of years in which the books were published. By default, the search is case-sensitive....

How to Scrape Google Ngrams?

To scrape google ngram, we will use Python’s requests and urllib libraries....

Contact Us