将wiktionary.com中的word数据解析为json对象的工具
wiktionaryparser的Python项目详细描述
向导分析器
一个python项目,它以易于使用的json格式解析wiktionary中的单词内容。 现在,它解析词源、定义、发音、示例、音频链接和相关单词。
json结构
[{"pronunciations":{"text":["pronunciation text"],"audio":["pronunciation audio"]},"definitions":[{"relatedWords":[{"relationshipType":"word relationship type","words":["list of related words"]}],"text":["list of definitions"],"partOfSpeech":"part of speech","examples":["list of examples"]}],"etymology":"etymology text",}]
安装
使用pip
- 运行
pip install wiktionaryparser
来源于
- 克隆回购协议或下载zip
cd
到文件夹- 运行
pip install -r "requirements.txt"
用法
- 导入WiktionaryParser类。
- 初始化一个对象并使用
fetch("word", "language")
方法。 - 默认语言是英语,可以使用
set_default_language method
更改。 - 包含/排除要使用
include_part_of_speech(part_of_speech)
和exclude_part_of_speech(part_of_speech)
分析的词类
- 包含/排除要使用
include_relation(relation)
和exclude_relation(relation)
分析的关系
示例
>>>fromwiktionaryparserimportWiktionaryParser>>>parser=WiktionaryParser()>>>word=parser.fetch('test')>>>another_word=parser.fetch('test','french')>>>parser.set_default_language('french')>>>parser.exclude_part_of_speech('noun')>>>parser.include_relation('alternative forms')
要求
- 请求数=2.7.0
- 美化组4==4.4.0
贡献
- 运行
pip install wiktionaryparser
来源于
- 克隆回购协议或下载zip
cd
到文件夹- 运行
pip install -r "requirements.txt"
用法
- 导入WiktionaryParser类。
- 初始化一个对象并使用
fetch("word", "language")
方法。 - 默认语言是英语,可以使用
set_default_language method
更改。 - 包含/排除要使用
include_part_of_speech(part_of_speech)
和exclude_part_of_speech(part_of_speech)
分析的词类 - 包含/排除要使用
include_relation(relation)
和exclude_relation(relation)
分析的关系
示例
>>>fromwiktionaryparserimportWiktionaryParser>>>parser=WiktionaryParser()>>>word=parser.fetch('test')>>>another_word=parser.fetch('test','french')>>>parser.set_default_language('french')>>>parser.exclude_part_of_speech('noun')>>>parser.include_relation('alternative forms')
要求
- 请求数=2.7.0
- 美化组4==4.4.0
贡献
如果您想添加功能/改进或报告问题,请随时发送请求!