Table of Contents

get class of ()

Description

The block analyses the specified test and provides the class name under which it has been classified by the NLP model.

Example

Speech Recognition
The example demonstrates how to make smart home automation for light control using NLP and Speech Recognition.

Script

Output

Read More
This project demonstrates how to create a voice-controlled smart plug using natural language processing (NLP), speech recognition, and a relay.

This project demonstrates how to create a voicecontrolled smart plug using natural language processing (NLP), speech recognition, and a relay.

Text Classifier in PictoBlox

We will use the PictoBlox Machine Learning environment for creating the text classifier.

Follow the steps to create the model:

  1. Open PictoBlox and the Machine Learning Environment.
  2. Click on Open Project and add import the following project file: Alexa
  3. Find the Alexa project in the list and open it to get the workspace of the text classifier.
  4. There will be 2 classes Lights On and Lights Off. Each class has some phases added corresponding to the action. You can add a few phases yourself.
  5. Click on Train Model to train the model.
  6. Once trained, you can check the model in the Testing tab. Add a phase and check if it provides the right sentiment.
    Note: If the model is not giving the desired results, then add more phases until the model is good.
  7. Click on the Export Model to create the blocks for the project.
  8. Test the block with some input text.

Circuit

The bulb is connected to the smart plug which is controlled with a relay.

Note:  A relay is an electromechanical switch that is used to turn on or turn off a circuit by using a small amount of power to operate an electromagnet to open or close a switch.

If the relay is ON, the smart switch gets ON, turning on the light. The relay has the following connections:

  1. GND Pin connected to GND of the Quarky Expansion Board.
  2. VCC Pin connected to VCC of the Quarky Expansion Board.
  3. Signal Pin connected to Servo 4 of the Quarky Expansion Board.

Code

The logic is the following – The Speech Recognition extension converts speech to text, which is then fed into the text classifier block. The text classifier block provides sentiment information, which is used to control the light via the relay.

Output

Read More
All articles loaded
No more articles to load