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
cdto 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!
Release files for wiktionaryparser 0.0.97
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wiktionaryparser-0.0.97.tar.gz | 17.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wiktionaryparser-0.0.97-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.3 kB
Release files / wiktionaryparser-0.0.97.tar.gz
| Download URL | wiktionaryparser-0.0.97.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0310388ad68586d68d573b220a2593a16b4702d2861502ce63299ff203bdbca1
|
|
BLAKE2b-256 checksum How to use checksums |
511246c23fc56ca2ca8dfbe5541f488bed4e9cebed19604cceba575ca2a63e38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.4
|
Release files / wiktionaryparser-0.0.97-py3-none-any.whl
| Download URL | wiktionaryparser-0.0.97-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81a96aee048d41f1a9ec9c9dd2b8c436fe2c4b02b70f30f63cf07495712f8ae3
|
|
BLAKE2b-256 checksum How to use checksums |
649ea2274834996d560387d8848ba9f9fd77d28b9f57eb2e4b3ad7108351bb16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.4
|