从python脚本中向链接发送命令。
pytronlinks的Python项目详细描述
与链接ai接口,并从python脚本中发送命令。通过链接Web服务发送请求 从任何你想要的电脑!大多数内置函数的链接都可以通过名称访问,并且始终可以添加更多链接。 如果您有任何请求,请随时在github上的问题下通知我。你也可以在那里报告错误。玩得高兴!
Links: ( Free Windows AI Software )http://mega-voice-command.com/
-页面底部更新下的更改日志-
示例
使用默认或自定义参数初始化主客户端。
param port: Port that links is listening on. param key: Links web key. param ip: ip of computer with links. param path: If you installed links in a different location. 示例:
importpytronlinksasPytronAI=Pytron.Client()
让链接说话!
importpytronlinksasPytronTEXT=('MVC Rocks!')AI=Pytron.Client()AI.talk(TEXT)
模拟链接语音
将调用该命令,就像您直接与链接交谈一样。
importpytronlinksasPytronTEXT=('what is the weather like')AI=Pytron.Client()AI.emulate_speech(TEXT)AI.emulate_speech("stop talking")
运行自定义操作命令
任何你可以放在链接action栏的东西,你都可以放在这里!参见示例。
importpytronlinksasPytronAI=Pytron.Client()AI.custom(r'[Set("Last Subject", "pytron is the coolest")]')AI.custom(r'[Speak("[Get("Last Subject")]")]')
获取所有可用命令的列表
返回所有可调用命令的列表。
即将推出 “与write_commands_to_file一起使用,创建一个包含所有可用语法的文件,用作引用。”
importpytronlinksasPytronAI=Pytron.Client()grammars=AI.GetGrammarList()forcommandsingrammars:printcommands
获得确认
在执行命令之前得到确认。示例中未显示其他参数。
param trigger_var: Variable in UserVariable.xml to be used for Confirmation ( Default Variable used: “Answer” ) param confirm: Confirmation speech ( Ex: “Are you sure you want to play music?” ) param on_yes: Speech response if answer is “yes” param on_no: Speech response if answer is “no”
importpytronlinksasPytron# Import Pytron""" **Make a command in links social tab like this** Command: {response=test_confirm} Response: [Set("Answer", {{response}})] Profile: Main **And add this wordlist to the wordlist folder.** -test_confirm.txt- yes or no answers clean response yes; yes please; affirmative; do it; go ahead; okay; sure; yup yes no; dont; stop; no i didnt; nope; no thank you; no thanks no """AI=Pytron.Client()query=AI.listen('Pytron')# Stars listening for input from Linksifquery=='quit':breakifquery=="Play music":# Get confirmation returns True or False so it can be checked directly, like this..ifAI.GetConfirmation(confirm="Do you want to play music?"):AI.emulate_speech('play music')
将脚本置于侦听模式
通过监视uservariables.xml文件中的变量来侦听用户输入(默认情况下为“pytron”)。变量是 使用links中的[set(“variable”,“value”)]命令进行设置。参见示例
importpytronlinks""" **Make a command in links social tab like this** Command: Links {speech=test_dictation} Response: [Set("Pytron", {speech})] Profile: Main And use the dictation in Pytron with the script below.. ( Ctrl-c to quit ) """importpytronlinksasPytronAI=Pytron.Client()defmain():dictation=AI.listen()ifdictation=='quit':breakelse:AI.talk(dictation)try:whileTrue:main()exceptKeyboardInterrupt:pass
逻辑函数
发送“通过细微差别表达雄辩”的语音命令(需要细微差别表达雄辩的语音)
param text: Text to be spoken ( with all the syntax they use, better make it raw, ie: r’text’ ) param volume: Volume 0 - 100 param rate: Rate of speech 0 - 100 ( 50 is default ) param ai_name: Name of tts Voice ( case sensitive ) 示例:
importpytronlinksasPytronai.LoqSpeak("I am an example","100","50","Simon")]
更新
- 新功能!
- changelog-v.0.3.9
- 修正了一些麻烦的局部变量。
- changelog-v.0.3.8
- 带回了urllib。我们只需要标准库。
- 稍微调整了一下客户。
- changelog-v.0.3.7
- 修复了客户端初始化时的错误
- 稍微清理了自述文件
- changelog-v.0.3.6
- 调整了callcommand函数。现在返回来自链接的响应
- 为新函数添加的文档字符串
- 搁置urllib以交换请求库
- 添加getGrammarList函数
- 将命令写入文件功能已添加(需要清除错误)
- changelog-v.0.3.5
- fixed listen()函数
- 添加了更多功能(还没有docstring,tsk tsk trabpukcip)
- changelog-v.0.3.3
- PEP-8
- 添加了其他文档字符串
- 使用sphinx创建文档
- changelog-v.0.3.2
- 在_get_request()中更好地处理错误响应(使用AST标准库模块)
- 优化的_get_xml()&u clear_xml()(感谢Zunair)
- 修正了get()函数(在url中输入错误)
- changelog-v.0.3.1
- 添加了对links uservariables.xml文件访问的XML支持
- 添加了更多的函数包装器-[get(“”),[set(“,”)]
- changelog-v.0.2.1
- 添加appdata作为链接安装的默认路径(ai=pytronlinks.client())
- 添加了“loquendo by nuance”函数包装器
- 还添加了一系列其他链接功能(查看自述文件)
- 添加get json响应验证(添加响应类型作为参数)
- 添加了自定义函数分析器
authors/h2>Scott Doucet/AKA:Trabpukcip/AKA:Duroktar/.a1>
推荐PyPI第三方库
- 热门话题
- 如何获得@sign,以便在Java代码中键入@override? java Facebook登录不起作用,我忘了什么? json如何在java中从MongoDB Atlas获取特定字段? java如何在Android上的JNI中实现委托/协议(在iOS上)? java为什么这个循环多次的程序在循环后有一个“println”时需要花费时间? java无法使组合框正常工作 JavaCQ5。如何为作者显示列表发布者?版本5.5 java我可以要求泛型参数具有泛型参数吗? JavaOKHTTP无法获取整个JSON 数组Java:用字符减去字符意味着什么? java为什么Eclipse content assist无法从部分方法名生成方法存根? java使用线程在Android Studio中一次加载一个多位图 java遍历二叉树并返回一个值