A Python Wiktionary Parser
A python project which downloads words from English Wiktionary (en.wiktionary.org) and parses articles' content in an easy to use JSON format. Right now, it parses etymologies, definitions, pronunciations, examples, audio links and related words.
[{
"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 install wiktionaryparser
cd
to the folderpip install -r "requirements.txt"
fetch("word", "language")
method.set_default_language method
.include_part_of_speech(part_of_speech)
and exclude_part_of_speech(part_of_speech)
include_relation(relation)
and exclude_relation(relation)
>>> 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')
If you want to add features/improvement or report issues, feel free to send a pull request!
Wiktionary Parser is licensed under MIT.