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
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!
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wiktionaryparser-0.0.97.tar.gz.
File metadata
- Download URL: wiktionaryparser-0.0.97.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0310388ad68586d68d573b220a2593a16b4702d2861502ce63299ff203bdbca1
|
|
| MD5 |
6ccd2abd1cc545f21313218aaaf6b59b
|
|
| BLAKE2b-256 |
511246c23fc56ca2ca8dfbe5541f488bed4e9cebed19604cceba575ca2a63e38
|
File details
Details for the file wiktionaryparser-0.0.97-py3-none-any.whl.
File metadata
- Download URL: wiktionaryparser-0.0.97-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81a96aee048d41f1a9ec9c9dd2b8c436fe2c4b02b70f30f63cf07495712f8ae3
|
|
| MD5 |
d60289b735f29baf34e6731ac37dd748
|
|
| BLAKE2b-256 |
649ea2274834996d560387d8848ba9f9fd77d28b9f57eb2e4b3ad7108351bb16
|