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.

Source Distribution

pywiktionary-0.0a1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

pywiktionary-0.0a1-py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page