Skip to main content

A python package to search in books available on wikisource.org

Project description

WikiSource

wikisource is a python package to help search the Wikisource Books

It offers a few classes to help find sentences in a book, or in a book collection.

For example, to search in a book for a specific string

from wikisource import WikiSource

book = WikiSource("https://fr.wikisource.org/wiki/Discours_de_la_m%C3%A9thode_(%C3%A9d._Cousin)"
book.search("bon sens")

To search in a collection of books, you can use:

from wikisource import Collection, WikiSource

books = Collection([WikiSource("https://fr.wikisource.org/wiki/Discours_de_la_m%C3%A9thode_(%C3%A9d._Cousin)"),
                    WikiSource("https://fr.wikisource.org/wiki/Les_Confessions_(Rousseau)"),
                    WikiSource("https://fr.wikisource.org/wiki/L%E2%80%99Origine_de_la_Trag%C3%A9die")])

books.search("bon sens")

The first search takes longer due to the fact that every chapter of the book needs to be downloaded locally. The next searches are faster.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wikisource-0.0.12.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

wikisource-0.0.12-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page