如是说
可视化式副手(也称作AI副手或位数副手)是这款能认知音频指示的语义并为采用者顺利完成某一各项任务的插件。
他们如果都知道甚么是可视化式副手,比如说关上智能手机并说“ Ok Google”或“ Hey Siri”就能转化成Google副手或Siri,Alexa,那些都是可视化式副手的代表者事例。
模拟YouTube音频:
https://youtu.be/LliTjuxDw_o
文本
他们要做甚么标识符表明完备的标识符GitHub军火库你怎样参予重大贡献评注1.他们要做甚么
他们的可视化式副手将能继续执行下列操作方式:
预报、开启格斗游戏、开启Windows插件、关上中文网站、说你基本上你所明确要求的大部份人,比如说说你年份和天数,致谢,新闻报道等。
你能与笔记型电脑的话筒/掌控面板展开可视化,可视化式副手聚合的积极响应将表明在掌控面板上,或是透过音箱间接说出。
可视化式副手今后的可能:自拍照,与人展开更深层的闲聊之类。
2. 标识符表明
让他们一起来建立自己的可视化式助手。
大部份标识符都能在我的GitHub上找出。我的电视频道上还提供更多了模拟YouTube音频和标识符传授YouTube音频。所需的镜像和应用软件如下表所示所说。如果你愿将那些展开撷取,我将叙尔热雷县。2.1 所需的软件包和库
pip install JarvisAI
这是我建立的新一代可视化式副手组件,它提供更多任何人可视化式副手的基本要素。先决条件是Python版 > 3.6。
用语和机能
加装DF93,你能引入组件:
import JarvisAI
obj = JarvisAI.JarvisAssistant()
response = obj.mic_input()
print(response)
不同机能对应不同方法名称。
mic_inputtext2speechshutdownwebsite_openersend_mailtell_me_datetell_me_timelaunch_any_appweathernewstell_me在这里阅读更多关于它的信息
https://pypi.org/project/JarvisAI/
你也能在这里为这个存储库做重大贡献。
https://github.com/Dipeshpal/Jarvis_AI
2.2 编码
导包
import JarvisAI
import re
import pprint
import random
根据文档建立 JarvisAI的对象
obj = JarvisAI.JarvisAssistant()
他们已经建立了“t2s(text)”函数,该函数会将任何人文本转换为音频。我们能采用(调用)此函数的整个程序从文本中产生音频。
def t2s(text):
obj.text2speech(text)
他们能不断接收采用者的输入,因此“ mic_input()
while True:
res = obj.mic_input()
预报:他们采用正则表达式来匹配采用者输入中的查询。如果在采用者输入“ res”中找出“天气”或“温度”,则他们会展开预报。无需从头开始编写东西,只需调用“ obj.weather(city = city)”即可。
他们能将此返回的“ weather_res”传递到“ t2s(weather_res)”,以从“ weather_res”字符串中产生音频。
while True:
res = obj.mic_input()
if re.search(weather|temperature, res):
city = res.split( )[-1]
weather_res = obj.weather(city=city)
print(weather_res)
t2s(weather_res)
新闻报道:与上述类似,匹配采用者输入“ res”中的“新闻报道”一词,如果匹配到,则调用“ obj.news”。
while True:
res = obj.mic_input()
if re.search(news, res):
news_res = obj.news()
pprint.pprint(news_res)
t2s(f”I have found {len(news_res)} news. You can read it. Let me tell you first 2 of them”)
t2s(news_res[0])
t2s(news_res[1])
,此过程你能采用obj.tell_me(topic)函数同时实现。
你需要将“主题”传递给“ tell_me(topic = topic)”。主题是搜索的关键字。
while True:
res = obj.mic_input()
if re.search(tell me about, res):
topic = res.split( )[-1]
wiki_res = obj.tell_me(topic)
print(wiki_res)
t2s(wiki_res)
年份和天数:它能说你系统的当前年份和天数。
while True:
res = obj.mic_input()
if re.search(date, res):
date = obj.tell_me_date()
print(date)
print(t2s(date))
if re.search(time, res):
time = obj.tell_me_time()
print(time)
t2s(time)
关上任何人中文网站:obj.website_opener(domain)会为你打
while True:
res = obj.mic_input()
if re.search(open, res):
domain = res.split( )[-1]
open_result = obj.website_opener(domain)
print(open_result)
开启任何人插件,格斗游戏等:
这个机能有点棘手,在“ obj.launch_any_app(path_of_app = path)”中,你需要传递“ .exe”文件路径的函数。
因此,他们建立了“ dict_app”字典,其中以“应用名称”作为键,以“路径”作为值。他们能采用“ dict
下列示例仅适用于Chrome和Epic Games。
while True:
res = obj.mic_input()
if re.search(launch, res):
dict_app = {
chrome: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe,
epic games: C:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win32\EpicGamesLauncher.exe
}
app = res.split( , 1)[1]
path = dict_app.get(app)
if path is None:
t2s(Application path not found)
print(Application path not found)
else:
t2s(Launching: + app)
obj.launch_any_app(path_of_app=path)
致谢和闲聊,现在的项目已经同时实现了自定义建立致谢和闲聊的机能。
我正在https://pypi.org/project/JarvisAI/上采用Tensorflow添加闲聊机能,你能为使其更好而做出重大贡献。
while True:
res = obj.mic_input()
if re.search(hello, res):
print(Hi)
t2s(Hi)
if re.search(how are you, res):
li = [good, fine, great]
response = random.choice(li)
print(f”I am {response}”)
t2s(f”I am {response}”)
if re.search(your name|who are you, res):
print(“My name is Jarvis, I am your personal assistant”)
t2s(“My name is Jarvis, I am your personal assistant”)
问“你能做甚么?”:在这里,他们只是采用“ obj.t2s()”来发表讲话。如果你了解python,则能轻松认知下列标识符
while True:
res = obj.mic_input()
if re.search(what can you do, res):
li_commands = {
“open websites”: “Example: open youtube.com”,
“time”: “Example: what time it is?”,
“date”: “Example: what date it is?”,
“launch applications”: “Example: launch chrome”,
“tell me”: “Example: tell me about India”,
“weather”: “Example: what weather/temperature in Mumbai?”,
“news”: “Example: news for today “,
}
ans = “””I can do lots of things, for example you can ask me time, date, weather in your city,
I can open websites for you, launch application and more. See the list of commands-“””
print(ans)
pprint.pprint(li_commands)
t2s(ans)
3.完备的标识符
import JarvisAI
import re
import pprint
import random
obj = JarvisAI.JarvisAssistant()
def t2s(text):
obj.text2speech(text)
while True:
res = obj.mic_input()
if re.search(weather|temperature, res):
city = res.split( )[-1]
weather_res = obj.weather(city=city)
print(weather_res)
t2s(weather_res)
if re.search(news, res):
news_res = obj.news()
pprint.pprint(news_res)
t2s(f”I have found {len(news_res)} news. You can read it. Let me tell you first 2 of them”)
t2s(news_res[0])
t2s(news_res[1])
if re.search(tell me about, res):
topic = res.split( )[-1]
wiki_res = obj.tell_me(topic)
print(wiki_res)
t2s(wiki_res)
if re.search(date, res):
date = obj.tell_me_date()
print(date)
print(t2s(date))
if re.search(time, res):
time = obj.tell_me_time()
print(time)
t2s(time)
if re.search(open, res):
domain = res.split( )[-1]
open_result = obj.website_opener(domain)
print(open_result)
if re.search(launch, res):
dict_app = {
chrome: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe,
epic games: C:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win32\EpicGamesLauncher.exe
}
app = res.split( , 1)[1]
path = dict_app.get(app)
if path is None:
t2s(Application path not found)
print(Application path not found)
else:
t2s(Launching: + app)
obj.launch_any_app(path_of_app=path)
if re.search(hello, res):
print(Hi)
t2s(Hi)
if re.search(how are you, res):
li = [good, fine, great]
response = random.choice(li)
print(f”I am {response}”)
t2s(f”I am {response}”)
if re.search(your name|who are you, res):
print(“My name is Jarvis, I am your personal assistant”)
t2s(“My name is Jarvis, I am your personal assistant”)
if re.search(what can you do, res):
li_commands = {
“open websites”: “Example: open youtube.com”,
“time”: “Example: what time it is?”,
“date”: “Example: what date it is?”,
“launch applications”: “Example: launch chrome”,
“tell me”: “Example: tell me about India”,
“weather”: “Example: what weather/temperature in Mumbai?”,
“news”: “Example: news for today “,
}
ans = “””I can do lots of things, for example you can ask me time, date, weather in your city,
I can open websites for you, launch application and more. See the list of commands-“””
print(ans)
pprint.pprint(li_commands)
t2s(ans)
4. Github仓库
你能随意采用我的标识符。如果你喜欢我的作品,请为其点亮star,同时请在YouTube上订阅。
只需克隆存储库
https://github.com/Dipeshpal/Jarvis-Assisant.git
然后运行pip install -r requirements.txt
它将自动加装大部份文本。
5. 怎样贡献
只需关上此GitHub存储库,阅读该书,你将知道你怎样才能做出重大贡献。
https://github.com/Dipeshpal/Jarvis_AI
你的重大贡献将反映在这个项目上。
https://pypi.org/project/JarvisAI/
6. 参考
GitHub存储库和标识符
https://github.com/Dipeshpal/Jarvis-Assisant.git
重大贡献的GitHub Pypi存储库
https://github.com/Dipeshpal/Jarvis_AI
JarvisAI库
https://pypi.org/project/JarvisAI/
YouTube电视频道
https://www.youtube.com/DIPESHPAL17
模拟和标识符(YouTube)
https://youtu.be/LliTjuxDw_o
参考镜像:https://www.analyticsvidhya.com/blog/2020/09/ai-virtual-using-python/