Note: Khuyến mãi cho chức năng click chuột = giọng nói á :))
Note2: Đọc hiểu code thì cứ chạy còn không thì đợi, đang viết web hướng dẫn (dùng python viết nên hơi lâu xí thông cảm) :))
$\\$
#main.py
import viass
while (b := viass.listen('Hello, what do you need?')) :
while b not in ('open video', 'google', 'youtube', 'facebook', 'now time', 'open question and answer', 'open gdb online', 'click mouse'):
b = viass.listen('I do not know what are you say, please try again')
if b == 'open video':
folder = viass.listen('What folder do you want to go to?')
choise = viass.VidChoise()
a.goto(viass.truePath(folder + ':/'))
while (number:= int(viass.listen('Choose the number of the folder or the file.'))):
if viass.system.path.isfile(choise.getwidget(number)):
vid = viass.Open()
vid.load(choise.getwidget(number))
vid.open()
while viass.listen() == 'close video':
vid.close()
break
if b == 'google':
keyword = viass.listen('What keyword do you want to search?')
web = viass.Google()
web.load(keyword)
web.open()
while viass.listen() == 'close google':
web.close()
if b == 'youtube':
keyword = viass.listen('What keyword do you want to search?')
ytb = viass.Youtube()
ytb.load(keyword)
ytb.open()
while viass.listen() == 'close youtube':
ytb.close()
if b == 'facebook':
fb = viass.Facebook()
fb.open()
while viass.listen() == 'close facebook':
fb.close()
if b == 'now time':
time = viass.dt.datetime.now()
h, m, s = str(time.time()).split(':')
viass.say('This time is '+ h + ' hours ' + m + ' minute ' + s + ' second')
if b == 'open question and answer':
hd247 = viadd.Hoidap247()
hd247.open()
while viass.listen() == 'close question and answer':
web.close()
if b == 'open gdb online':
gdb = viass.OGDB()
gdb.open()
while viass.listen() == 'close gdb online':
web.close()
if b == 'click mouse':
x = viass.text2int(viass.listen('What is x position?'))
y = viass.text2int(viass.listen('What is y position?'))
viass.pag.click(x,y)
$\\$
#viass\__fb.py
from .__lb import *
def FB():
wb.open('facebook.com')
$\\$
#viass\__init__.py
from . import __vidopagg
from . import __ytb
from .__fb import *
from .__lb import *
class Open(__vidopagg.Main):
def __init__(self):
super().__init__()
def close(self):
close()
class VidChoise(__vidopagg.VidChoise):
...
class Google:
def __init__(self):
self.this = Open()
def load(self, link):
self.this.load('coccoc.com/search?query='+link)
def open(self):
self.this.open()
def close(self):
self.this.close()
class Youtube(__ytb.Youtube):
def __init__(self):
super().__init__()
def close(self):
close()
class Facebook:
def open(self):
FB()
def close(self):
close()
class Hoidap247:
def open(self):
self.web = Open()
self.web.load('hoidap247.com')
self.web.open()
def close(self):
close()
class OGDB:
def open(self):
self.web = Open()
self.web.load('onlinegdb.com')
self.web.open()
def close(self):
close()
def say(string):
engine = pt3.init()
engine.say(string)
engine.runAndWait()
def listen(string=''):
say(string)
engine = sr.Recognizer()
with sr.Microphone() as mic:
audio = engine.listen(mic)
try:
audio = engine.recognize_google(audio)
except:
audio = ''
audio = audio.lower()
return audio
def truePath(string):
return Path(string)
$\\$
#viass\__lb.py
import webbrowser as wb
import pyautogui as pag
import datetime as dt
import speech_recognition as sr
import pyttsx3 as pt3
import os as system
import tkinter as tk
def close():
pag.hotkey('alt', 'f4')
def text2int(textnum, numwords={}):
if not numwords:
units = [
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen",
]
tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
scales = ["hundred", "thousand", "million", "billion", "trillion"]
numwords["and"] = (1, 0)
for idx, word in enumerate(units): numwords[word] = (1, idx)
for idx, word in enumerate(tens): numwords[word] = (1, idx * 10)
for idx, word in enumerate(scales): numwords[word] = (10 ** (idx * 3 or 2), 0)
current = result = 0
for word in textnum.split():
if word not in numwords:
raise Exception("Illegal word: " + word)
scale, increment = numwords[word]
current = current * scale + increment
if scale > 100:
result += current
current = 0
return result + current
def Path(string):
if (string[-1] == '/' or string[-1] == '\\'):
return string
else:
if '/' in string:
return string + '/'
else:
return string + '\\'
$\\$
#viass\__vidopagg.py
from .__lb import *
class Main:
def load(self, link):
self.__link = link
def open(self):
wb.open(self.__link)
class VidChoise(tk.Tk):
def __init__(self):
super().__init__()
self.argv = []
self.name = []
self.path = 'C:/'
def goto(self, path='C:/', newPath = True):
for widget in self.argv:
widget.destroy()
self.argv.clear()
self.name.clear()
if newPath:
self.path = path
else:
self.path = Path(self.path) + path
count = 1
for dof in system.listdir(self.path):
if system.path.isfile(self.path+dof):
self.argv.append(tk.Label(self, text = str(count) + '. File: ' + dof))
self.name.append((self.path+dof, 'file'))
else:
self.argv.append(tk.Label(self, text = str(count) + '. Folder: ' + dof))
self.name.append((self.path+dof, 'die'))
count += 1
for widget in self.argv:
widget.pack(side=tk.TOP)
def getwidget(self, index):
return self.name[index-1]
def start(self):
self.mainloop()
$\\$
#viass\__ytb.py
from .__lb import *
class Youtube:
def load(self, link):
self.__link = link.replace(' ','+')
def open(self):
wb.open('youtube.com/results?search_query='+self.__link)
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 7 - Năm thứ hai ở cấp trung học cơ sở, một cuồng quay mới lại đến vẫn bước tiếp trên đường đời học sinh. Học tập vẫn là nhiệm vụ chính!
Nguồn : ADMIN :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK