Posts

Showing posts from August, 2020

Python Speech To Text

About  A few lines of code written in python using libraries (SpeechRecognition, PyAudio) that convert speech to text. Prerequisites In order to run the python script, your system must have the following programs/packages installed. Python 3.6.7 SpeechRecognition 3.8.1 (Internet required to convert speech to text while execution) PyAudio Approach script.py execute in terminal. After a printed start in the terminal, you begin to speak in English and end once your sentence is completed. It will take a few minutes to convert speech to text and print it on your terminal. Code # Program to convert speech to text # Author @inforkgodara import speech_recognition as sr r = sr.Recognizer() mic = sr.Microphone() print('start') with mic as source: audio = r.listen(source) print('end')  print(r.recognize_google(audio))  

Python Chat Application

  About  It is a simple project and contains two python scripts server.py which handle client request and client.py send request and receive response from the server through socket communication. Prerequisites In order to run the python script, your system must have the following programs/packages installed and the contact number should be saved in your phone (You can use bulk contact number saving procedure of email). There is a way without saving the contact number but has the limitation to send the attachment. Python 3.8 Approach server.py needed to execute in terminal. client.py needed to execute from the client machine and enter the hostname or IP address. the server will establish connection between the server and the client through socket. now from the server or client text can be sent. Server Code # Program to accept client request # Author @inforkgodara import socket s = socket.socket() host = socket.gethostname() print(' Server will start on host : ', host) port = 8

JavaScript Custom Stack

About  It is a custom stack class in JavaScript similar to Array stack functionality. Intention to create it is the practice of stack data structure. It has total 5 methods, Description of every method is underfollowed. Methods push() — Adds a value at the end of the stack. pop() — Removes and returns the value at the end of the stack. size() — Returns size of the stack. peek() — Returns a value at the end of the stack. toString() — Returns a string representation of the stack. Code /** * This is an implementation of custom stack class. * @author Ramesh Kumar * */ class Stack { /** * initialization of an object. */ constructor() { this.counter = 0; this.storage = {}; } /** * Adds a value at the end of the stack. * @param value new value for the stack. */ push(value) { this.storage[this.counter] = value; this.counter++; return this.counter; } /** * Removes and returs the value at th

JavaScript Custom Set

About  It is a custom set class in JavaScript similar to Set in es2015. It has total 7 methods, Description of every method is underfollowed. Methods add() — Adds an element to the set. has() — Checks whether a particular element exists or not in set. values() — Returns all the values on the set. remove() — Removes an element from the set. union() — Returns union of two sets. intersection() — Returns intersection of two sets. difference() — Returns the difference of two sets. Code /** * This is an implementation of custom set class. * @author Ramesh Kumar * */ class Set { /** * initialization of an object. */ constructor() { this.collection = []; } /** * Adds an element to the set. * @param Set value an element for Set */ add(value) { if (!this.has(value)) { this.collection.push(value); return true; } return false; } /** * Checks weather a particular element is exis