Linux终端里的Siri----Betty

原文来自于webupd8,原文标题Betty Is Like Siri Or Google Now For The Command Line (Translates Plain English Into Commands),作者Andrew。

———————————————————————————————————————————————————

应用于命令行的Betty有点像Siri和Google Now。她将白话英语翻译成命令:在终端里面显示命令,运行,当然还有输出。

Betty不是通过语音控制的,所以你还是要将你要说的话敲到终端里面,当然如果你想的话,她可以念出命令的输出内容。根据Betty项目的GitHub主页的介绍,她的任务就是提供一个通过自然语言来使用计算机的方式。“具体地说,好处就是能够在电脑上做些事而不需要离开命令行或在网上到处找正确的命令。Betty就能做到。”例如,如果你忘记了解压和压缩的命令,你只要让Betty来做的

Linux terminal:~$
betty uncompress archive.tar.gz

当然,目前Betty支持的命令还是有限的,她现在才只有两周大。但是她会成长很快,由于添加新命令的工作难度不是很大(目前有17为贡献者在为此工作)。
Betty0.1.5支持很多命令,例如:
  • count(数或者文件中的字符,字典中的词数等);
  • config(改你的名字);
  • datetime(当前时间、日期等);
  • Find(在文件中查找);
  • Internet / web 问题(下载文件,查找天气等);
  • 文件/目录操作(压缩/解药文件,显示文件大小,修改权限等);
  • processes;
  • user command(用户名,真名,ip地址,其他登录的人等);
  • 控制iTunes和Spotify;
  • 更多。
以下是一些例子:
$ betty whats my username
Betty: Running whoami
andrei

$ betty how many words are in gnome3 
Betty: Running find gnome3 -type f -exec wc -w {} \; | awk '{total += $1} END {print total}'
214

$ betty download http://cdimage.ubuntu.com/daily-live/current/utopic-desktop-amd64.iso to ubuntu-14.10-daily.iso
Betty: Running curl -o ubuntu-14.10-daily.iso http://cdimage.ubuntu.com/daily-live/current/utopic-desktop-amd64.iso

$ betty turn web mode on
Betty: Web queries ON

$ betty whats the weather like in Bucharest
Asking the internet...
Betty: Bucarest, Bucuresti: It is currently patchy light rain in area with thunder, 63 Fahrenheit

$ betty turn web mode on
Betty: Web queries ON

$ betty translate "command line" to Spanish
Asking the internet...
Betty: Línea de comandos

$ betty whats the meaning of life
Betty: 42.


支持的命令的完整列表可以在GitHub上获取到(在Documentation下)。

在Linux上安装Betty

1.安装Ruby(Betty需要) ,安装curl(有些Betty的命令需要)。以Ubuntu为例,使用以下命令安装:
sudo apt-get install ruby curl

2. 安装git,下载最新的Betty,用以下命令:
sudo apt-get install git
cd && git clone https://github.com/pickhardt/betty

或者不用Git,下载Betty的压缩文件通过这里。解压到你的home下,将文件夹名字重命名为 "betty"。

3. 最后,你要添加"betty/main.rb" 这个文件的路径,还要将之取别名为 "betty" 添加到膜的 ~/.bashrc 。 可以通过以下命令完成(假设你已经将Betty下载到你的home下):
echo "alias betty=\"~/betty/main.rb\"" >> ~/.bashrc
source ~/.bashrc

想要贡献,提交Bug,查看最新代码和官方安装指导的,参看BettyGitHub 项目页面.

猜你喜欢

转载自blog.csdn.net/leaf5022/article/details/36423661