• Home
  • Projects
  • Virtual Doctor Using Natural Language Processing Extension in PictoBlox

Virtual Doctor Using Natural Language Processing Extension in PictoBlox

Virtual Doctor Using NLP
About This Project

In this project, we are going to make a virtual doctor. To whom you need to tell your symptoms to him and he will tell you what caught you and what shall you do next.

Project Info

Introduction

You feel a little unwell, who do you tell your symptoms first? (Except mom.) Google! Yes, you google the symptoms, find what is the thing that has made you unwell, and then you move on to find a remedy for the same.

In this project, we are going to make a virtual doctor using the NLP extension. You need to tell your symptoms to him and he will tell you what caught you and what shall you do next.

Wonder how will the virtual doctor figure the disease as many have a couple of symptoms same. Using NLP!

So let’s begin by understanding what NLP is.

Components Required

ImageComponentQuantityAvailable in Kit
PictoBloxDownload NOW

Building Guide

Step 1: What is NLP?

NLP stands for Natural Language Processing.

This is the area of AI concerned with the interaction between computers and humans in natural language. The aim of this extension is to help computers understand language as well as we do.

Along with the NLP Extension, there are a lot of new features added to the latest version of PictoBlox. You may need to download PictoBlox or update it to use the latest features.

Step 2: Setting the Stage for the Virtual Doctor

Open PictoBlox.

Let’s begin by setting up the stage.

  1. Delete Tobi’s Sprite.
  2. Click on Upload Sprite Button and upload the Doctor Sprite.Doctor Sprite
  3. Go to the Backdrop Palette, add the Blue Sky backdrop from the library.
  4. To get the hospital on the stage, Upload the image of hospital as the backdrop.Hospital Sprite
  5. You may find the one backdrop of Blue Sky and one of the hospital. Copy the hospital image and then paste it into the backdrop of Blue Sky.
  6. Adjust the placement of the hospital and doctor according to your choice.
  7. The final stage will look like this:Setting the stage for Virtual Doctor

 You can download the sprites of doctor and hospital from here.

Step 3: Training the Text Classifier

Now that we have set the stage. Let’s begin by training the text data for diseases. We need to train PictoBlox to analyze the text and perform the corresponding action.

Add text data in classes       

We will first add data i.e the symptoms for three diseases, COVID-19, Malaria, and Diabetes one-by-one.

  1. Go to the My Blocks palette and create a block named Data for COVID-19.

    Text Classifier

  2. To make the text classifier, we need the Natural Language Processing extension. Add the Natural Language Processing extension from the extension library.
  3. Take the Data for COVID-19 hat block and drop an add () as () block below it.

  4. In place of text in the add () as () block, write the first command, “Dry Cough”. In place of class, write “COVID-19”. COVID-19 will be the name of the class.

    text classifier

  5. We’re going to give the classifier three more symptoms to add to our class. You can add many as you may find. Duplicate the add () as () block and write the rest of the symptoms in them.

    text classifier

  6. Now, we similarly need to add text training blocks for the other two diseases too.

    text classifier

    text classifier

Training the Classifier

Now that we have added data in classes, we need to train our classifier.

  1. Create a block named Train Data.
  2. Take the Train Data hat block and add a reset text classifier block below it from the Natural Language Processing palette.

    reset text classifier block in NLP

  3. Add the Data for COVID-19, Data for Malaria, and Data for Diabetes stack blocks one after the other.
  4. Add a train text classifier block.

    Train text classifier block

  5. The script will look like this:

    Training Classifier using NLP

With this our text classifier for our virtual doctor is trained, it’s time to bring it into action.

To get step-by-step training for AI and ML, you can look into the Online Course for Artificial Intelligence for Kids.

Step 4: Final Script for the Virtual Doctor Using NLP

Let’s begin to write the script that to make the virtual doctor say the name of the disease we have after we tell him our symptoms.

  1. Add a when flag clicked hat block to run the script when the green flag is clicked.        
  2. Drop the Train Data stack block below it.script for virtual doctor using NLP
  3. Let’s make the doctor greet us. Add a say () for () seconds block from the Looks palette. Write “Hello! Welcome to the virtual hospital” in the first space given.
  4. Next, we’ll want the doctor to ask the symptoms, thus from the Operators palette, add a ask () and wait block. Write “How are you feeling today? Please tell me your symptoms.” in the space given.Virtual doctor using NLP
  5. Here is when we will write the symptoms and the doctor will tell us the remedies for the same. Place an if () block into the scripting area.
  6. Add an () = () block from the Operator palette.
  7. Inside the first space of the () = () block, drop a get class of () block. In the second space, write “COVID-19”.Get class of block
  8. Inside the get class of () block, drop a answer block from the Sensing palette.
  9. This will check the symptoms you enter with the text data, and if they match with COVID class, the doctor will say out the disease as COVID-19.
  10. matching the symptom entered by patient with the train dataInto the if () arm place a say () for () seconds block.
  11. Place join () () block from the Operator palette.
  12. Write “You are infected with  ” in the first space. Add another join block in the second space. Drop a get class of () block into the first space of the second join block and write “.” to complete the statement in the second space. Inside the get class of () block, drop an answer block from the Sensing palette.Diagonising the dieases
  13. Now that we got to know the disease, doctor will say the remedy for the same. Place a say () for () seconds block from the Looks Palette and write the remedies into it. If you need to write more remedies, you can use another say block too.COVID diagonized and remedy
  14. With this diagnosis of COVID is done, we will now follow similar steps for Malaria and Diabetes. Duplicate the if block and make the changes respectively. Malaria diagonized and remedyDiabetesdiagonized and remedy
  15. With this our script is complete. Virtual doctor using NLP in PictoBlox

Press the green flag to start the script.

Step 5: Conclusion

To escalate the project instead of typing your symptoms you can use speech recognition blocks to recognize your voice and then diagnosis the diseases.

Code

DescriptionDownload Code
Virtual Doctor Using NLPDownload
Share this Project
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Featured Projects