# mwconstants
Various utilities and constants useful for analyses of wikitext. This package contains three types of artifacts:
* **Data generating functions**: Python functions for calling various APIs to build useful data structures -- e.g., all Wikipedia language codes
* **Static data snapshots**: Python variables that contain the most recent result of a data generating function
* **Utilities**: Python functions for handling various wikitext-related processing tasks -- e.g., mapping links to namespaces.
## Installation
You can install `mwconstants` with `pip`:
```bash
$ pip install mwconstants
```
## Basic Usage
```python
from mwconstants import link_to_namespace, NON_WHITESPACE_LANGUAGES
print(link_to_namespace('Utilisateur:Isaac_(WMF)', lang='fr')) # 'User'
print(sorted(NON_WHITESPACE_LANGUAGES)) # ['bo', 'bug', ..., 'zh-classical', 'zh-yue']
```
## Modules
All modules generally contain relevant constants, functions for generating those constants, and other useful utilities for manipulating them:
* `languages.py`: functions for identifying languages associated with a given Wikimedia project.
* `media.py`: functions for identifying media in wikitext and parsing wikitext media syntax into its components
* `namespaces.py`: functions for identifying namespace prefixes
## Limitations
* Links have many edge-cases, especially around interwiki prefixes. For now, just the basics are covered: language-specific namespaces and interlanguage links
Raw data
{
"_id": null,
"home_page": "https://gitlab.wikimedia.org/repos/research/mwconstants",
"name": "mwconstants",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,wikitext,wiki",
"author": "geohci (Isaac Johnson)",
"author_email": "<isaac@wikimedia.org>",
"download_url": "https://files.pythonhosted.org/packages/d5/85/a5416773f5a33feeffd7b9b78992e07a78b7e33b2b57a448e66eeebd3c68/mwconstants-0.1.0.tar.gz",
"platform": null,
"description": "\n# mwconstants\n\nVarious utilities and constants useful for analyses of wikitext. This package contains three types of artifacts:\n* **Data generating functions**: Python functions for calling various APIs to build useful data structures -- e.g., all Wikipedia language codes\n* **Static data snapshots**: Python variables that contain the most recent result of a data generating function\n* **Utilities**: Python functions for handling various wikitext-related processing tasks -- e.g., mapping links to namespaces.\n\n## Installation\n\nYou can install `mwconstants` with `pip`:\n\n```bash\n $ pip install mwconstants\n```\n\n## Basic Usage\n\n```python\nfrom mwconstants import link_to_namespace, NON_WHITESPACE_LANGUAGES\n\nprint(link_to_namespace('Utilisateur:Isaac_(WMF)', lang='fr')) # 'User'\nprint(sorted(NON_WHITESPACE_LANGUAGES)) # ['bo', 'bug', ..., 'zh-classical', 'zh-yue']\n```\n\n## Modules\nAll modules generally contain relevant constants, functions for generating those constants, and other useful utilities for manipulating them:\n* `languages.py`: functions for identifying languages associated with a given Wikimedia project.\n* `media.py`: functions for identifying media in wikitext and parsing wikitext media syntax into its components\n* `namespaces.py`: functions for identifying namespace prefixes\n\n## Limitations\n* Links have many edge-cases, especially around interwiki prefixes. For now, just the basics are covered: language-specific namespaces and interlanguage links\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Various data and utilities for processing wikitext.",
"version": "0.1.0",
"split_keywords": [
"python",
"wikitext",
"wiki"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "e0026009610924fd3d884bdbe0f04156",
"sha256": "3023602ed465a5428e59d5a5fc51b0151acb4fc6246714d572f542d9efbb0786"
},
"downloads": -1,
"filename": "mwconstants-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e0026009610924fd3d884bdbe0f04156",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 93885,
"upload_time": "2022-12-19T19:30:13",
"upload_time_iso_8601": "2022-12-19T19:30:13.653326Z",
"url": "https://files.pythonhosted.org/packages/0d/19/e60761e20dd4e7609c76e126ba415b03de11c172dcc8290322dd8c75e069/mwconstants-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "4b32d6bbbcbc452c8ebcb06b4c01a5a5",
"sha256": "81cd90b1080e13053e55326856c1b78156c9f8612a403f0095c4f1a0b1488415"
},
"downloads": -1,
"filename": "mwconstants-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "4b32d6bbbcbc452c8ebcb06b4c01a5a5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 90516,
"upload_time": "2022-12-19T19:30:15",
"upload_time_iso_8601": "2022-12-19T19:30:15.013155Z",
"url": "https://files.pythonhosted.org/packages/d5/85/a5416773f5a33feeffd7b9b78992e07a78b7e33b2b57a448e66eeebd3c68/mwconstants-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-19 19:30:15",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "mwconstants"
}