这是一个生成随机英语单词的简单python包

Random-Word的Python项目详细描述


随机词

Build StatusPyPI versionPyPI - Python VersionPyPI - StatusCodacy BadgeDownloadsLicense: MIT

这是一个生成随机英语单词的简单python包。 如果您在阅读完下面的内容后需要帮助,请在twitter上的@vaibhavsingh97找到我。

如果你喜欢这个包裹,请:开始2:回购。

安装

您应该能够使用easy_installpip以通常的方式安装:

$ 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()

提前使用

  1. 要生成单个随机单词,我们可以使用这些可选参数

    • hasDictionaryDef (string)-仅返回具有字典定义的单词(可选)
    • includePartOfSpeech (string)-csv要包含的部分语音值(可选)
    • excludePartOfSpeech (string)-csv要排除的部分语音值(可选)
    • minCorpusCount (integer)-术语的最小语料库频率(可选)
    • {< CD8> } -术语的最大语料库频率(可选)
    • minDictionaryCount (integer)-最小字典计数(可选)
    • {{CD10}} -最大字典计数(可选)
    • minLength (integer)-最小字长(可选)
    • {< CD12> } -最大字长(可选)
    r.get_random_word(hasDictionaryDef="true",includePartOfSpeech="noun,verb",minCorpusCount=1,maxCorpusCount=10,minDictionaryCount=1,maxDictionaryCount=10,minLength=5,maxLength=10)# Output: pediophobia
  2. 要生成随机单词列表,我们可以使用这些可选参数

    • hasDictionaryDef (string)-仅返回具有字典定义的单词(可选)
    • includePartOfSpeech (string)-csv要包含的部分语音值(可选)
    • excludePartOfSpeech (string)-csv要排除的部分语音值(可选)
    • minCorpusCount (integer)-术语的最小语料库频率(可选)
    • {< CD8> } -术语的最大语料库频率(可选)
    • minDictionaryCount (integer)-最小字典计数(可选)
    • {{CD10}} -最大字典计数(可选)
    • minLength (integer)-最小字长(可选)
    • {< CD12> } -最大字长(可选)
    • sortBy (string)-按alphacount排序的属性(可选)
    • sortOrder (string)-按ascdesc排序方向(可选)
    • {< CD28 > }返回的最大结果数(可选)
    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']
  3. 为了获得最新消息,我们可以使用这些可选参数

    • 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"}]}

开发

假设您已经安装了^{}^{},那么设置您的环境并安装这样的必需依赖项,而不是上面定义的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/找到许可证的副本

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在reducer中迭代自定义可写组件时出现java问题   属性文件中属性的java命名约定   任务链关闭的java Executor服务   java从Eclipse中的字段生成多个构造函数   java通过继承读取Json   java在不知道密钥的情况下解析json   java camel cxf如何在电子邮件中发送soap请求响应   java程序似乎跳过了if语句的一部分,在移回正确位置之前先移到else语句   测试简单的Java加密/解密inputFileName不存在   java从Jenkins REST API获取所有作业的所有构建的构建细节   java基本包装器和静态“类型”类对象   在WebSphere8.5上部署java代码   java对象相等(对象引用“=”)   java MongoDB整型字段到枚举的转换   每次我重新导入gradle时,IntelliJ都会不断重置Java设置   类型使用键或索引从Java中的数据类型检索值   在Java的列表接口中需要listIterator()和iterator()是什么?