本文介绍一款命令行字典和词汇构建工具:Pyvoc,它用Python语言编写且开源跨平台。使用此工具,你可以刷新一些英语单词含义,测试或提高你的词汇技能,或者只是在类Unix操作系统上将其用作CLI词典。
相关链接
安装Pyvoc的方法
由于Pyvoc是使用Python语言编写的,因此可以使用Pip3包管理器进行安装:
$ pip3 install pyvoc
安装后,运行以下命令以在$HOME目录中自动创建必要的配置文件:
$ pyvoc word
输出信息如下:
|Creating necessary config files/getting api keys. please handle with care!|
word
Noun: single meaningful element of speech or writing
example: I don't like the word ‘unofficial’
Verb: express something spoken or written
example: he words his request in a particularly ironic way
Interjection: used to express agreement or affirmation
example: Word, that's a good record, man
到这就完成安装了。
使用Pyvoc作为命令行字典工具
Pyvoc从Oxford Dictionary API获取单词含义。
比如你想找到digression一词的含义,请运行:
$ pyvoc digression
Pyvoc不仅显示单词digression的含义,还显示了如何在实际中使用该单词的示例句子。
让我们看另一个例子:
$ pyvoc subterfuge
|subterfuge
Noun: deceit used in order to achieve one's goal
example: he had to use subterfuge and bluff on many occasions
它还显示了单词类,英语有四个主要的单词类:名词、动词、形容词、副词。
看一下下面的例子:
$ pyvoc welcome
/welcome
Noun:instance or manner of greeting someone
example:you will receive a warm welcome
Interjection:used to greet someone in polite or friendly way
example:welcome to the Wildlife Park
Verb:greet someone arriving in polite or friendly way
example:hotels should welcome guests in their own language
Adjective:gladly received
example:I'm pleased to see you, lad—you're welcome
正如你在上面的输出中所看到的,welcome这个词可以用作动词、名词、形容词和感叹词。 Pyvoc已经为每个类提供了示例。
如果拼错了单词,它会通知你检查给定单词的拼写:
$ pyvoc wlecome
\No definition found. Please check the spelling!!
创建词汇组
词汇组只不过是用户添加的集合词,你可以稍后修改或从这些组中进行测验,为用户保留100组60个字。
要向一个组添加一个单词(例如sporadic),只需运行:
$ pyvoc sporadic -a
-sporadic
Adjective: occurring at irregular intervals or only in few places
example: sporadic fighting broke out
writing to vocabulary group...
word added to group number 51
我没有提供任何组号和pyvoc显示给定单词的含义并自动将该单词添加到组号51,如果不提供组号,Pyvoc将逐步向组51-100添加单词。
Pyvoc还允许指定组号,可以使用-g选项指定1-50中的组,例如,我将使用以下命令向词汇表组20添加一个单词:
$ pyvoc discrete -a -g 20
/discrete
Adjective:individually separate and distinct
example:speech sounds are produced as a continuous sound signal rather than discrete units
creating group Number 20...
writing to vocabulary group...
word added to group number 20
上面的命令显示discrete单词的含义并将其添加到词汇组20,如果该组不存在,Pyvoc将创建它并添加单词。
默认情况下,Pyvoc包含三个预定义的词汇表组(101,102和103),这些自定义组每个有800个单词,这些小组中的所有单词都来自GRE和SAT网站。
要查看用户生成的组,只需运行:
$ pyvoc word -l
-word
Noun:single meaningful element of speech or writing
example:I don't like the word ‘unofficial’
Verb:express something spoken or written
example:he words his request in a particularly ironic way
Interjection:used to express agreement or affirmation
example:Word, that's a good record, man
USER GROUPS
Group no. No. of words
20 1
DEFAULT GROUP
Group no. No. of words
51 1
上面信息得出,我创建了一个组(20),包括默认组(51)。
测试和提高英语词汇量
你可以使用词汇组修改或从中获取测验。
例如,要修改组号,101,使用-r选项如下:
$ pyvoc 101 -r
现在可以按随机顺序修改词汇表组101中所有单词的含义,只需按ENTER键即可完成下一个问题,完成后,按CTRL+C退出:
此外,你从现有组中进行测验以提高词汇量,为此,请使用如下所示的-q选项:
$ pyvoc 103 -q 50
此命令允许你从词汇组103中获取50个问题的测验,通过输入相应的数字从列表中选择正确的答案,每个正确的答案你都会获得1分,得分越高,你的词汇技能就越高:
到这里,这款词典词汇工具Pyvoc的内容就讲完了。
相关主题