这是一个生成随机英语单词的简单python包
Random-Word的Python项目详细描述
随机词
这是一个生成随机英语单词的简单python包。 如果您在阅读完下面的内容后需要帮助,请在twitter上的@vaibhavsingh97找到我。
如果你喜欢这个包裹,请:开始2:回购。
安装
您应该能够使用easy_install
或pip
以通常的方式安装:
$ easy_install random-word $ pip install random-word
或者克隆此存储库并运行:
$ python3 setup.py install
或者将下载的random-word
文件夹放在脚本可以访问的地方。
基本用法
fromrandom_wordimportRandomWordsr=RandomWords()# Return a single random wordr.get_random_word()# Return list of Random wordsr.get_random_words()# Return Word of the dayr.word_of_the_day()
提前使用
要生成单个随机单词,我们可以使用这些可选参数
hasDictionaryDef (string)
-仅返回具有字典定义的单词(可选)includePartOfSpeech (string)
-csv要包含的部分语音值(可选)excludePartOfSpeech (string)
-csv要排除的部分语音值(可选)minCorpusCount (integer)
-术语的最小语料库频率(可选)
{< CD8> } -术语的最大语料库频率(可选) minDictionaryCount (integer)
-最小字典计数(可选)minLength (integer)
-最小字长(可选)要生成随机单词列表,我们可以使用这些可选参数
hasDictionaryDef (string)
-仅返回具有字典定义的单词(可选)includePartOfSpeech (string)
-csv要包含的部分语音值(可选)excludePartOfSpeech (string)
-csv要排除的部分语音值(可选)minCorpusCount (integer)
-术语的最小语料库频率(可选)
{< CD8> } -术语的最大语料库频率(可选) minDictionaryCount (integer)
-最小字典计数(可选)minLength (integer)
-最小字长(可选)sortBy (string)
-按alpha
或count
排序的属性(可选)sortOrder (string)
-按asc
或desc
排序方向(可选)为了获得最新消息,我们可以使用这些可选参数
date (string)
-按日期获取yyy-mm-dd(可选)
r.word_of_the_day(date="2018-01-01")# Output: {"word": "qualtagh", "definations": [{"text": "The first person one encounters, either after leaving one\'s home or (sometimes) outside one\'s home, especially on New Year\'s Day.", "source": "wiktionary", "partOfSpeech": "noun"}, {"text": "A Christmas or New Year\'s ceremony, in the Isle of Man; one who takes part in the ceremony. See the first extract.", "source": "century", "partOfSpeech": "noun"}]}
r.get_random_word(hasDictionaryDef="true",includePartOfSpeech="noun,verb",minCorpusCount=1,maxCorpusCount=10,minDictionaryCount=1,maxDictionaryCount=10,minLength=5,maxLength=10)# Output: pediophobia
r.get_random_words(hasDictionaryDef="true",includePartOfSpeech="noun,verb",minCorpusCount=1,maxCorpusCount=10,minDictionaryCount=1,maxDictionaryCount=10,minLength=5,maxLength=10,sortBy="alpha",sortOrder="asc",limit=15)# Output: ['ambivert', 'calcspar', 'deaness', 'entrete', 'gades', 'monkeydom', 'outclimbed', 'outdared', 'pistoleers', 'redbugs', 'snake-line', 'subrules', 'subtrends', 'torenia', 'unhides']
开发
假设您已经安装了^{pip install random-word
:
$ git clone https://github.com/vaibhavsingh97/random-word.git
$ cd random-word
$ pipenv install
...
$ pipenv shell
在random_word
目录中添加api键,在config.py
目录中定义api键。如果没有api密钥,则请求api密钥here
API_KEY="<API KEY>"
之后,在本地安装软件包
$ pip install -e .
问题
您可以在issue tracker
许可证
由瓦伊巴夫·辛格(@vaibhavsingh97)在MIT License下用建造
您可以在https://vaibhavsingh97.mit-license.org/找到许可证的副本