Scraping grapheme-to-phoneme data from Wiktionary.
Project description
WikiPron
WikiPron is a command-line tool, Python API, database for mining multilingual pronunciation data from Wiktionary, as well as sample grapheme-to-phoneme models trained on this data.
If you use WikiPron in your research, please cite the following:
Jackson L. Lee, Lucas F.E. Ashby, M. Elizabeth Garza, Yeonju Lee-Sikka, Sean Miller, Alan Wong, Arya D. McCarthy, and Kyle Gorman (2020). Massively multilingual pronunciation mining with WikiPron. In LREC, to appear.
Command-line tool
Installation
WikiPron requires Python 3.6+. It is available through pip:
pip install wikipron
Usage
Quick Start
After installation, the terminal command wikipron
will be available. As a
basic example, the following command scrapes G2P data for French:
wikipron fra
Specifying the Language
The language is indicated by a three-letter ISO
639-2 or ISO
639-3 language code,
e.g., fra
for French. For which languages can be scraped,
here
is the complete list of languages on Wiktionary that have pronunciation entries.
Output
The scraped data is organized with each <word, pronunciation> pair on its own
line, where the word and pronunciation are separated by a tab. Note that the
pronunciation is in International Phonetic Alphabet
(IPA), segmented
by spaces that correctly handle the combining and modifier diacritics for
modeling purposes, e.g., we have kʰ æ t
with the aspirated k instead of
k ʰ æ t
.
For illustration, here is a snippet of French data scraped by WikiPron:
accrémentitielle a k ʁ e m ɑ̃ t i t j ɛ l
accrescent a k ʁ ɛ s ɑ̃
accrétion a k ʁ e s j ɔ̃
accrétions a k ʁ e s j ɔ̃
By default, the scraped data appears in the terminal. To save the data in a TSV file, please redirect the standard output to a filename of your choice:
wikipron fra > fra.tsv
Advanced Options
The wikipron
terminal command has an array of options to configure your
scraping run. For a full list of the options, please run wikipron -h
.
Python API
The underlying module can also be used from Python. A standard workflow looks like:
import wikipron
config = wikipron.Config(key="fra") # French, with default options.
for word, pron in wikipron.scrape(config):
...
Data
We also make available a database of 1.7 million word/pronunciation pairs mined using WikiPron.
Models
We host grapheme-to-phoneme models and modeling software in a separate repository.
Development
Repository
The source code of WikiPron is hosted on GitHub at https://github.com/kylebgorman/wikipron, where development also happens.
For the latest changes not yet released through pip
or working on the codebase
yourself, you may obtain the latest source code through GitHub and git
:
-
Create a fork of the
wikipron
repo on your GitHub account. -
Locally, make sure you are in some sort of a virtual environment (venv, virtualenv, conda, etc).
-
Download and install the library in the "editable" mode together with the core and dev dependencies within the virtual environment:
git clone https://github.com/<your-github-username>/wikipron.git cd wikipron pip install --upgrade pip setuptools pip install -r requirements.txt pip install --no-deps -e .
We keep track of notable changes in CHANGELOG.md.
Contribution
For questions, bug reports, and feature requests, please file an issue.
If you would like to contribute to the wikipron
codebase, please see
CONTRIBUTING.md.
License
WikiPron is released under an Apache 2.0 license. Please see LICENSE.txt for details.
Please note that Wiktionary data has its own licensing terms, as does the other data in the languages/ subdirectory.
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
Built Distribution
File details
Details for the file wikipron-1.1.0.tar.gz
.
File metadata
- Download URL: wikipron-1.1.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 379ca9391c440d2bd634c849a9e5cbfca75a9afb5edcaf571c4996b6985e5f0f |
|
MD5 | 963512668f1a36106efb0dddc2882f54 |
|
BLAKE2b-256 | 0a2431b15472859c445d0426bdd0f8d5d2a1f38b93370ce2395dbd0ef016f63a |
File details
Details for the file wikipron-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: wikipron-1.1.0-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef6489b2915228b9ce4ebcb39220b0e4ac2e6c4db077540a38081c7e49759e33 |
|
MD5 | 1d4a5acfa4e38cf9f37f3430bdb9747d |
|
BLAKE2b-256 | 9a42bad57092d3402afbe1dc83df4944a79d0180fb4419d8428b013a78f3ff58 |