Skip to main content

Wikitext Asymptote

Custom wikitext parser to produce html, plain text fields and relevant links from wikipedia page source code.

Get started

To install the wikitext_asymptote package, simply run

pip install wikitext_asymptote

You can then use the package as follows:

import wikitext_asymptote as wa

# Raw wikitext goes here
page = """..."""

# Parse it
parsed_page = wa.parse_page(page)

# parsed_page contains fields for html, plain text or links
print(parsed_page)

# parsed_page = {
#     'html': '...',
#     'text': '...',
#     'opening_text': '...',
#     'auxiliary_text': [...],
#     'heading': [...],
#     'links': [...]
# }

About

This package was created to fulfill the precise needs for parsing wikitext in the context of the EPFL Graph project, which are a bit more involved than the defaults from mwparserfromhell.

However, the task of parsing wikitext taking into account all its syntax is gigantic. Already deciding, not even implementing, the parsing of each template in the myriad that's available, with all its variations, is virtually unfeasible.

Hence, the approach we have decided to commit to is that of approximation (hence Asymptote). We try to parse a number of templates, tags and other entities as correctly as possible, in a way that most cases are covered. In addition, we also have defaults, which may or may not be adequate for some cases. This implies that the parsed output is not perfect, and that is by design. From that point on, we work on a case-by-case basis to include parsing for new templates, tags or other entities, should the need arise.

Acknowledgements

Wikitext asymptote is built on top of the mwparserfromhell package, so we acknowledge and are grateful for the work of their creators.

Metadata

Release files for wikitext-asymptote 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wikitext-asymptote 0.0.4
File Size Uploaded
wikitext_asymptote-0.0.4.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wikitext-asymptote 0.0.4
File Interpreter ABI Platform
wikitext_asymptote-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 20.6 kB

Release files / wikitext_asymptote-0.0.4.tar.gz

Download URL wikitext_asymptote-0.0.4.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
faa8ef902a37b7ea0eb0349367d372949080d95e4f7bcde5bebf879e7e882cd1
BLAKE2b-256 checksum
How to use checksums
e99d31d5d7a04670f4cab3dc6b0cc7be39d69959a49fa89aa9ad27d87eab38df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release files / wikitext_asymptote-0.0.4-py3-none-any.whl

Download URL wikitext_asymptote-0.0.4-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c44be141ebd556a507827f139d478528d22d2206f15989e9492825e356b4f30
BLAKE2b-256 checksum
How to use checksums
1515ab00f448a90f3d69c8d74a009d4b56db0a3f0f35c6360a8c3910d1ed1b9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page