A small Python library for searching Wikipedia pages and extracting summaries and hyperlinks.
Project description
wikilink-search
A small Python library for searching Wikipedia pages and extracting page titles, summaries, and outgoing hyperlinks.
This project is designed to be useful for search algorithms, graph exploration, tabular reinforcement learning, and DQN environments where Wikipedia pages can be treated as states and hyperlinks as actions.
Installation
pip install -e .
Dependencies
pip install requests beautifulsoup4
Basic usage
from wikiverse import WikiClient
wiki = WikiClient(language="en")
results = wiki.search("Alan Turing", limit=5)
for result in results:
print(result.title, result.url)
page = wiki.page("Alan Turing")
print(page.title)
print(page.summary)
print(page.links[:10])
Top pages
from wikiverse import WikiClient
wiki = WikiClient(language="en")
top_pages = wiki.top_pages(limit=10)
for page in top_pages:
print(page.title, page.url)
Why this library?
The main goal is to provide a simple and predictable interface for using Wikipedia as a graph-like environment:
- page = state
- hyperlink = action
- target page = next state
This makes it suitable for experiments with:
- BFS / DFS / A*
- shortest path search
- tabular Q-learning
- SARSA
- DQN
- page navigation agents
Notes
This MVP uses requests and beautifulsoup4 only. Be respectful with request frequency when scraping Wikipedia.
Use cache and delays in larger experiments.
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wikiverse-0.1.0.tar.gz.
File metadata
- Download URL: wikiverse-0.1.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4473062383fd9fdee3c29587f7e73ee060f3ddd61a283220a1d20c1693c2b660
|
|
| MD5 |
9745f5ec59485a59af85ffa38160caa6
|
|
| BLAKE2b-256 |
9193856b566bdf76c3c63aced18ee2b29522209ea7f6392ef908c28e908d724d
|
File details
Details for the file wikiverse-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wikiverse-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cda243d2029a56406083e67a490e09112281f80d3c84d600f6adea7803eca8b
|
|
| MD5 |
4ae49c3c7dd325a2d0cb32465e86f47e
|
|
| BLAKE2b-256 |
c920195cd43d8ec190ba085707c792ed1393cad77aafc3229e50fc8b173cf921
|