Development of newsreader AI assistant for windows using python 3.8...
Nowadays Artificial Intelligence (AI) become most useful in every field for e.g, Bussiness development, Educational institution, Research, and development areas, etc. So because of the growing trend of AI indicates most of the work of humans will be replaced by a machine and most of the difficult work can be easily completed by a machine.
So in this topic, we will develop a news reading assistant in our system using a python programming language with version 3.8.
Let's start developing a news reading assistant step by step.
Step:1 ▶ First of all install python 3.8 in your system and run the command in your terminal which is given below.
pip install pypiwin32
This is a python module that is used to dispatch the voice of our assistant. it uses the dispatch method and it takes SAPI.SpVoice an argument to interact with the Microsoft Speech SDK to speak.
Step:2 ▶ Then import win32com.client in your python IDE and use the dispatch method to connect with the voice. The code for this step is given below:
import win32com.client speaker = win32com.client.Dispatch("SAPI.SpVoice") speaker.speak("Hello World!!")
When you run this code then you will get a voice "Hello World" which means your code is running accurately.
Step:3 ▶ This is the most important step because we have to fetch the news data from the website. So for this, we will use the NEWS API.
Go to the NEWS API website and get the API key after sign up and use the URL for fetching news data. URL is like this:
Note: Please do not use this URL because it will not work so you have to generate your personal API key and then only your URL is working.
Step:4 ▶ After creating the URL we need to get the data from the web to our system so for that we will use the python HTTP get request method. Use the command given below :
import requests r = requests.get(url) r.json()
With the help of this code, you will get all data in JSON format. JSON data return a dictionary(key: value) pair so you can iterate it.
Step:5 ▶ At the end put all the code sequentially and run it in your system and your AI reading assistant is ready for your service.
So this is the simple model of AI newsreader assistant you can enhance it by adding some extra features and it all depends on your skills...
-Subscribe for more such content
-Check out our curated amazon page for the latest trending products