Skip to main content

A library for parsing the french wiktionnary

Project description

WiktionnaireParser

A library for parsing the french wiktionary.

Installation

Supported Python versions : 3.6+

With Pip

pip install wiktionnaireparser

From source

python setup.py install

Usage

>>> from wiktionnaireparser import WiktionnaireParser as wiktp
>>> page = wiktp.from_source('nage PMT')
>>> page.get_etymology()
'Forme abrégée de nage avec palmes, masque et tuba.'
>>> page.get_parts_of_speech()
{'Locution nominale': ['(Plongée) Nage avec palmes, masque et tuba.']}

It is also possible to pick a word at random.

>>> page.random_page()
>>> page.get_title()
'décrocher'

Use get_word_data to extract and display all data

>>> from wiktionnaireparser import WiktionnaireParser as wtp
>>> page = wtp.from_source('anglophone')
>>> page.get_word_data
{
    'title': 'anglophone',
    'etymologies': 'Composé du préfixe latin anglo pour anglais et du suffixe -phone.',
    'partOfSpeech': {
        'Nom commun': {
            0: {
                'definition': 'Personne parlant la langue anglaise.',
                'examples': {
                    0: {
                        'example': 'La minorité anglaise avait également reçu, de façon encore plus discrète, une autre «\xa0protection\xa0»: le trésorier du Québec serait un anglophone, un anglophone choisi par les financiers. —\xa0(Laurent Laplante, Paul Berryman, 2000)'
                    }
                }
            },
            'translations': {
                'Allemand': ['Englischsprachige'],
                'Anglais': ['English-speaker', 'anglophone'],
                'Breton': ['saozneger'],
                'Catalan': ['anglòfon', 'anglòfona', 'angloparlant'],
                'Espagnol': ['anglófono', 'anglófona', 'anglohablante'],
                'Espéranto': ['anglalingvano'],
                'Italien': ['anglofono'],
                'Néerlandais': ['Engelstalige'],
                'Portugais': ['anglófono', 'anglofalante', 'angloparlante'],
                'Roumain': ['anglofon']
            },
            'pronunciation': ['ɑ̃.ɡlɔ.fɔn'],
            'gender': 'masculin et féminin identiques'
        },
        'Adjectif': {
            0: {
                'definition': 'De langue anglaise.',
                'examples': {
                    0: {
                        'example': "Selon plusieurs penseurs de l'époque, l'État québécois est le seul qui puisse rivaliser avec les grandes entreprises anglophones d'Amérique du Nord. —\xa0(Mathieu Bureau Meunier, Wake up mes bons amis!, Québec, Septentrion, 2019, p. 133.)"
                    }
                }
            },
            'translations': {
                'Allemand': ['englischsprachig'],
                'Anglais': ['anglophone'],
                'Espagnol': ['anglófono', 'anglohablante'],
                'Espéranto': ['anglalingva'],
                'Italien': ['anglofono'],
                'Kazakh': ['ағылшынтілді'],
                'Néerlandais': ['Engelstalig'],
                'Norvégien (bokmål)': ['engelskspråklig'],
                'Portugais': ['anglófono', 'anglofalante', 'angloparlante'],
                'Roumain': ['anglofon']
            },
            'pronunciation': ['ɑ̃.ɡlɔ.fɔn'],
            'gender': 'masculin et féminin identiques'
        }
    }
}

How to contribute

Contributions are more than welcome.

If you're new to Python and would like to contribute, get inspiration from the TODOs.

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

wiktionnaireparser-0.0.5.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

wiktionnaireparser-0.0.5-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file wiktionnaireparser-0.0.5.tar.gz.

File metadata

  • Download URL: wiktionnaireparser-0.0.5.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.12

File hashes

Hashes for wiktionnaireparser-0.0.5.tar.gz
Algorithm Hash digest
SHA256 16ce166afbcf07b5dd641b88e2a14d6e4bad157cb5fd5dfb31f8a8db5c175be9
MD5 700a45d45078ee32b0d622752e2e7ba8
BLAKE2b-256 f3471e59756c0105b2f1deb03372ae3e82957121e882ca0becabd3f154dc94a7

See more details on using hashes here.

File details

Details for the file wiktionnaireparser-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: wiktionnaireparser-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.12

File hashes

Hashes for wiktionnaireparser-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8fd5d5b1ac227871ada2155429b707016d293cf1c5c5cc2788b4c9bb9c8ac2e8
MD5 dad0a675d17027c20375e379368db72b
BLAKE2b-256 ee0cc7d210b993777b94c3f01c33798d9e2f04e2450b52cd1e353d04cce2d9c7

See more details on using hashes here.

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