Generate Wiki Summary using Python

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article

Hello world!

In this Blog article, we will learn how to Generate Wiki Summary. We will see the implementation in Python.

Check out the Repository for Ultimate Resource in python. Drop a star if you find it useful! Got anything to add? Open a PR on the same!

You can refer to my YouTube video Tutorial to see a working tutorial for better Understanding and a step by step Guide of the same.

What will be covered in this Blog

1. What is Wikipedia?
3. Basics of pywhatkit Module
4. Generating Wiki Summary using Python

Let's get started!

What is Wikipedia?:

Wikipedia is a free, open content online encyclopedia created through the collaborative effort of a community of users known as Wikipedians. Anyone registered on the site can create an article for publication.

If you wish to know more about it, you can refer to Wiki's Wikipedia Page.

Module Used:

pywhatkit Module:

PyWhatKit is a Python library with various helpful features. It is an easy to use library which does not requires you to do some additional setup.

This module has lots of other cool features as well. Feel free and go ahead to explore them or if you wish I can write an article about them.

If you wish to know more about it, you can refer to pywhatkit Module Documentation.

Now that you are familiar with Wikipedia basics and have acquired basic knowledge of pywhatkit module, we can move forward to the coding section.

Time to Code!

You can find all the code at my GitHub Repository. Drop a star if you find it useful.

code.png

In order to access the Python library, you need to install it into your Python environment

pip install pywhatkit as kt

Now, we need to import the package in our python script. Use the following command to do so.

import pywhatkit as kt

Now that we have imported the library using the command import pywhatkit as kt, let's proceed.

Let's display a welcome message. we will make use of print method for the same.

print("Lets Generate Wiki Summary!")

Be sure of what you want to search and once you decide, let's store it in target1.

target1 = "Python"

Finally, let's call info method.

kt.info(target1,lines=3)

NOTE: Here we are passing in two parameters:

  • the 1st parameter depicts the topic of search used to generate wiki summary
  • 2nd parameter depicts the number of lines of summary you want

Let's have a look at the output search result.

output.png

OUTPUT:
Let's generate Wiki summary!

Python is an interpreted, high-level and general-purpose programming language used worldwide. Python's design philosophy emphasizes code readability with its notable use of significant whitespace. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.Python is dynamically typed and garbage-collected.

Let's have a look at another example.

target2 = 'coronavirus'
print('\n')
kt.info(target2,lines=3)

image.png With these steps, we have successfully Performed Google search using python. That's it!

Simple, isn't it? Hope this tutorial has helped. I would strongly recommend you to Check out the YouTube video of the same and don't forget to subscribe my Channel.

You can play around with the pywhatkit library and even explore more features.

You can find all the code at my GitHub Repository. Drop a star if you find it useful.

Thank you for reading, I would love to connect with you at Twitter | LinkedIn.

Do share your valuable suggestions, I appreciate your honest feedback!

You should definitely check out my other Blogs:

Resources:

See you in my next Blog article, Take care!!

Comments (3)

Salami Samod's photo

Thanks very much for this beautiful piece, you made learning fun and so much easier. Could you please make a tutorial on the request module to get a specific content of the webpage.

Ayushi Rawat's photo

Thankyou. will try that.

Salami Samod's photo

Ayushi Rawat thank you very much