Skip to main content

Python library to retrieve wiktionary word definitions for different languages

Project description

PyWiktionary - a Python library for wiktionary words

Version 0.0.1 (pre-alpha)

This is just a pre alpha that need so many enhancements and fixes, but could be a starting base to start a simple python library for Wiktionary words

Install

Requirements

Before install, please, make sure you've installed the project dependencies if you're installing from source code:

$ pip install -r ./requirements.txt

Pywiktionary install

Install from the source code:

$ pip install .

How to use

First of all initialize the wiki parser with a supported language then make the request and at the end call the parse() method of the parser object returned from WiktionaryParser :

from pywiktionary import WiktionaryParser

wiktionary_parser = WiktionaryParser(default_language='en')
language_parser = wiktionary_parser.get_page('pizza')
result = language_parser.parse()

The result variable is dictionary containing the result of the wiktionary page parsing. Here the result for "pizza":

{
  "pizza": {
    "meanings": {
      "noun": [
        {
          "meaning": "(uncountable) A baked Italian dish of a thinly rolled bread dough crust typically topped before baking with tomato sauce, cheese, and other ingredients such as meat, vegetables or fruit",
          "examples": []
        },
        {
          "meaning": "(countable) A single instance of this dish",
          "examples": []
        }
      ]
    }
  }
}

Yeah, yeah... i know it is beautiful and easy as idea, but it now require some development to enhance this system!

Supported languages

  • English - en
  • Italian - it

ToDo

  • Implement a good system to select wiktionary language parser
  • Write a good human friend documentation! =)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pywiktionary, version 0.0a1
Filename, size File type Python version Upload date Hashes
Filename, size pywiktionary-0.0a1-py3-none-any.whl (6.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pywiktionary-0.0a1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page