Posts

Showing posts from January, 2020

Personal Voice Assistant Using Python

import pyttsx3 #pip install pyttsx3 import speech_recognition as sr #pip install speechRecognition import datetime import wikipedia #pip install wikipedia import webbrowser import os import smtplib import re from pyowm import OWM import sys import subprocess engine = pyttsx3.init( 'sapi5' ) voices = engine.getProperty( 'voices' ) # print(voices[1].id) engine.setProperty( 'voice' , voices[ 0 ].id) def speak(audio): engine.say(audio) engine.runAndWait() def wishMe(): hour = int(datetime.datetime.now().hour) if hour>= 0 and hour< 12 : speak( "Good Morning!" ) elif hour>= 12 and hour< 18 : speak( "Good Afternoon!" ) else : speak( "Good Evening!" ) speak( "I am Jarvis Sir. Please tell me how may I help you" ) def takeCommand(): #It takes microphone input from the user and returns string output r = sr.Recognizer() with sr.Microphone() as sour

WAP in Java to perform the following Operation in String(Icse String Program)

Input:Matrix Output:Mti Input: Hi All Output:H l import java.util.*; class Xplore2 {     public static void main(String args[])     {         String s;         int i,p=0;         char c;         Scanner sc=new Scanner(System.in);         System.out.println("Enter the String");         s=sc.nextLine();         for(i=0;i<s.length();i++)         {             c=s.charAt(i);             p=p+1;             if(p%2!=0)             {                 System.out.print(c);             }              else if(p%2!=0 && c==' ')             {                 System.out.print(c);             }         }     } }         
WAP in Java to perform the following Operation in String(Icse String Program) Input:vital information resources under seize Output:virus import java.util.*; class jit {         public static void main(String args[])         {             int i,l;             char c;             String s,w="";             Scanner sc=new Scanner(System.in);             System.out.println("Enter the String");             s=sc.nextLine();             for(i=0;i<s.length();i++)             {                 c=s.charAt(i);                 if(c==' ')                 {                     w=w+(s.charAt(i+1));                 }             }             System.out.print(w);         }     }