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.
![Downloads](http://pepy.tech/badge/wiktionaryparser)
#### JSON structure
```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",
}]
```
#### 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)` and `exclude_part_of_speech(part_of_speech)`
- Include/exclude relations to be parsed using `include_relation(relation)` and `exclude_relation(relation)`
#### Examples
```python
>>> 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!
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.
![Downloads](http://pepy.tech/badge/wiktionaryparser)
#### JSON structure
```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",
}]
```
#### 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)` and `exclude_part_of_speech(part_of_speech)`
- Include/exclude relations to be parsed using `include_relation(relation)` and `exclude_relation(relation)`
#### Examples
```python
>>> 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
wiktionaryparser-0.0.94.tar.gz
(17.2 kB
view hashes)
Built Distribution
Close
Hashes for wiktionaryparser-0.0.94-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e77646590c0720d33364807b3ffb1c45c291f1cf21f0f9057b9868e994ebe675 |
|
MD5 | ec00b7adf53011f54520603a8456400d |
|
BLAKE2b-256 | d3acdba761c56eed13cd87a76d87b43cad5fe42c8acac9bc3271d3c271764d13 |