A tool to parse word data from wiktionary.com into a JSON object
Project description
Wiktionary Parser
A python project which parses word content from Wiktionary in an easy to use JSON format. Right now, it parses etymologies, definitions, pronunciations, examples, audio links and related words.
JSON structure
[{
"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",
}]
Installation
Using pip
- run
pip install wiktionaryparser
From Source
- Clone the repo or download the zip
cd
to the folder- run
pip install -r "requirements.txt"
Usage
- Import the WiktionaryParser class.
- Initialize an object and use the
fetch("word", "language")
method. - The default language is English, it can be changed using the
set_default_language method
. - Include/exclude parts of speech to be parsed using
include_part_of_speech(part_of_speech)
andexclude_part_of_speech(part_of_speech)
- Include/exclude relations to be parsed using
include_relation(relation)
andexclude_relation(relation)
Examples
>>> from wiktionaryparser import WiktionaryParser
>>> 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')
Requirements
- requests==2.7.0
- beautifulsoup4==4.4.0
Contributions
If you want to add features/improvement or report issues, feel free to send a pull request!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
wiktionaryparser-0.0.96-py3.6.egg
(28.2 kB
view hashes)
Close
Hashes for wiktionaryparser-0.0.96-py3.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | a782724557570ea81af8338e677753dd2d5cc83d9a708edf03fdf43c6d25f6fa |
|
MD5 | 29dc077e7558e78e52db4c4086f7e71c |
|
BLAKE2b-256 | 408e6199bd837311c6c763c32d5c08617db789e427ef4731bc502056b62b497e |