{"id":17649275,"url":"https://github.com/abuccts/wikt2pron","last_synced_at":"2025-05-07T03:46:14.648Z","repository":{"id":137823812,"uuid":"93480887","full_name":"abuccts/wikt2pron","owner":"abuccts","description":"A Python toolkit converting pronunciation in enwiktionary xml dump to cmudict format","archived":false,"fork":false,"pushed_at":"2019-07-05T08:59:14.000Z","size":177,"stargazers_count":33,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-07T03:46:05.457Z","etag":null,"topics":["cmudict","parser","wiktionary"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abuccts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-06T05:47:28.000Z","updated_at":"2024-10-14T00:10:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"c37c5602-1de5-48cc-a16e-201d981363ae","html_url":"https://github.com/abuccts/wikt2pron","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abuccts%2Fwikt2pron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abuccts%2Fwikt2pron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abuccts%2Fwikt2pron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abuccts%2Fwikt2pron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abuccts","download_url":"https://codeload.github.com/abuccts/wikt2pron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252810274,"owners_count":21807759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmudict","parser","wiktionary"],"created_at":"2024-10-23T11:25:17.797Z","updated_at":"2025-05-07T03:46:14.643Z","avatar_url":"https://github.com/abuccts.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"wikt2pron\n=========\n\n__A Wiktionary Pronunciation Collector__\n\n[![Build Status](https://travis-ci.org/abuccts/wikt2pron.svg?branch=master)](https://travis-ci.org/abuccts/wikt2pron)\n[![Documentation Status](https://readthedocs.org/projects/wikt2pron/badge/?version=latest)](http://wikt2pron.readthedocs.io/en/latest/?badge=latest)\n[![Join the chat at https://gitter.im/enwiktionary2cmudict/Lobby](https://badges.gitter.im/enwiktionary2cmudict/Lobby.svg)](https://gitter.im/enwiktionary2cmudict/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![BSD licensed](https://img.shields.io/badge/License-BSD-blue.svg)](LICENSE)\n\nWikt2pron is a Python toolkit converting pronunciation in enwiktionary xml dump to cmudict format.\nIt supports [IPA](https://en.wikipedia.org/wiki/International_Phonetic_Alphabet) and [X-SAMPA](https://en.wikipedia.org/wiki/X-SAMPA) format at present.\nThis project is developed in [GSoC 2017](https://summerofcode.withgoogle.com/dashboard/student/proposal/5169382905872384/) with [CMU Sphinx](https://cmusphinx.github.io/) community.\n\nCollected pronunciation dictionaries and related example models can be downloaded at [Dropbox](https://www.dropbox.com/sh/1anleakrnm5ednt/AAAXeSY0abHxFLcXOr4OkVJ9a?dl=0).\n\nRequirements\n------------\n\nwikt2pron requires:\n* Python 3\n* [regex](https://pypi.python.org/pypi/regex/)\n* [python-mwxml](https://github.com/mediawiki-utilities/python-mwxml)\n* [beautifulsoup4](https://www.crummy.com/software/BeautifulSoup/)\n\nInstallation\n------------\n\n```sh\n# download the latest version\n$ git clone https://github.com/abuccts/wikt2pron.git\n$ cd wikt2pron\n\n# install and run test\n$ python setup.py install\n$ python setup.py -q test\n\n# make documents\n$ make -C docs html\n```\n\nUsage\n-----\n\n##### Extract pronunciation from Wiktionary XML dump\n\nFirst, create an instance of `Wiktionary` class:\n```py\n\u003e\u003e\u003e from pywiktionary import Wiktionary\n\u003e\u003e\u003e wikt = Wiktionary(XSAMPA=True)\n```\nUse the example XML dump in [[pywiktionary/data]](pywiktionary/data):\n```py\n\u003e\u003e\u003e dump_file = \"pywiktionary/data/enwiktionary-test-pages-articles-multistream.xml\"\n\u003e\u003e\u003e pron = wikt.extract_IPA(dump_file)\n```\nHere's the extracted result:\n```py\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e pprint(pron)\n[{'id': 16,\n  'pronunciation': {'English': [{'IPA': '/ˈdɪkʃ(ə)n(ə)ɹɪ/',\n                                 'X-SAMPA': '/\"dIkS(@)n(@)r\\\\I/',\n                                 'lang': 'en'},\n                                {'IPA': '/ˈdɪkʃənɛɹi/',\n                                 'X-SAMPA': '/\"dIkS@nEr\\\\i/',\n                                 'lang': 'en'}]},\n  'title': 'dictionary'},\n {'id': 65195,\n  'pronunciation': {'English': 'IPA not found.'},\n  'title': 'battleship'},\n {'id': 39478,\n  'pronunciation': {'English': [{'IPA': '/ˈmɜːdə(ɹ)/',\n                                 'X-SAMPA': '/\"m3:d@(r\\\\)/',\n                                 'lang': 'en'},\n                                {'IPA': '/ˈmɝ.dɚ/',\n                                 'X-SAMPA': '/\"m3`.d@`/',\n                                 'lang': 'en'}]},\n  'title': 'murder'},\n {'id': 80141,\n  'pronunciation': {'English': [{'IPA': '/ˈdæzəl/',\n                                 'X-SAMPA': '/\"d{z@l/',\n                                 'lang': 'en'}]},\n  'title': 'dazzle'}]\n```\n\n##### Lookup pronunciation for a word\n\nFirst, create an instance of `Wiktionary` class:\n```py\n\u003e\u003e\u003e from pywiktionary import Wiktionary\n\u003e\u003e\u003e wikt = Wiktionary(XSAMPA=True)\n```\nLookup a word using `lookup` method:\n```py\n\u003e\u003e\u003e word = wikt.lookup(\"present\")\n```\nThe entry of word \"present\" is at https://en.wiktionary.org/wiki/present, and here is the lookup result:\n```py\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e pprint(word)\n{'Catalan': 'IPA not found.',\n 'Danish': [{'IPA': '/prɛsanɡ/', 'X-SAMPA': '/prEsang/', 'lang': 'da'},\n            {'IPA': '[pʰʁ̥ɛˈsɑŋ]', 'X-SAMPA': '[p_hR_0E\"sAN]', 'lang': 'da'}\n],\n 'English': [{'IPA': '/ˈpɹɛzənt/', 'X-SAMPA': '/\"pr\\\\Ez@nt/', 'lang': 'en'},\n             {'IPA': '/pɹɪˈzɛnt/', 'X-SAMPA': '/pr\\\\I\"zEnt/', 'lang': 'en'},\n             {'IPA': '/pɹəˈzɛnt/', 'X-SAMPA': '/pr\\\\@\"zEnt/', 'lang': 'en'}],\n 'Ladin': 'IPA not found.',\n 'Middle French': 'IPA not found.',\n 'Old French': 'IPA not found.',\n 'Swedish': [{'IPA': '/preˈsent/', 'X-SAMPA': '/pre\"sent/', 'lang': 'sv'}]}\n```\n\nTo lookup a word in a certain language, specify the `lang` parameter:\n```py\n\u003e\u003e\u003e wikt = Wiktionary(lang=\"English\", XSAMPA=True)\n\u003e\u003e\u003e word = wikt.lookup(\"read\")\n\u003e\u003e\u003e pprint(word)\n[{'IPA': '/ɹiːd/', 'X-SAMPA': '/r\\\\i:d/', 'lang': 'en'},\n {'IPA': '/ɹɛd/', 'X-SAMPA': '/r\\\\Ed/', 'lang': 'en'}]\n```\n\n##### IPA -\u003e X-SAMPA conversion\n\n```py\n\u003e\u003e\u003e from pywiktionary import IPA\n\u003e\u003e\u003e IPA_text = \"/t͡ʃeɪnd͡ʒ/\" # en: [[change]]\n\u003e\u003e\u003e XSAMPA_text = IPA.IPA_to_XSAMPA(IPA_text)\n\u003e\u003e\u003e XSAMPA_text\n\"/t__SeInd__Z/\"\n```\n\nCitation\n--------\n\nIf you use wikt2pron in your research and want to cite it, please use the following BibTeX:\n```tex\n@misc{xiong2017wikt2pron,\n  title={Wikt2pron: A Wiktionary Pronunciation Collector},\n  author={Xiong, Yifan},\n  howpublished={\\url{https://github.com/abuccts/wikt2pron}},\n  year={2017}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabuccts%2Fwikt2pron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabuccts%2Fwikt2pron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabuccts%2Fwikt2pron/lists"}