Pyvoc-命令行字典和词汇构建工具

时间:2020-03-21 11:46:42  来源:igfitidea点击:

Pyvoc是一个用Python编程语言编写的跨平台,开源,命令行字典和词汇构建工具。
使用此工具,我们可以复习一些英语单词的含义,测试或者提高词汇技能,或者仅将其用作类似于Unix的操作系统上的CLI字典。

安装Pyvoc

由于Pyvoc是使用Python语言编写的,因此我们可以使用Pip3软件包管理器进行安装。

一旦安装了Pip,请运行以下命令来安装Pyvoc。

$pip3 install pyvoc

安装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用作命令行字典工具和词汇构建工具

Pyvoc从牛津词典API中获取单词的含义。

让我们说,我们想找到“离题”一词的含义。
为此,请运行:

$pyvoc digression

看到了吗?
Pyvoc不仅显示单词“离题”的含义,还显示一个例句,说明如何在实际中使用该单词。

让我们来看另一个例子。

$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个单词供用户使用。

要将单词(例如零星的单词)添加到组中,只需运行:

$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

看到了吗?
上面的命令显示“离散”单词的含义,并将其添加到词汇组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分。
我们得分越高,词汇能力就越强。