Skip to main content

Utilities for extracting XML, HTML, CSV, and other data types with a common interface

Project description

Textcavator Readers

Python package Documentation Status

textcavator-readers is a python module to extract data from a variety of formats, including CSV, XML, HTML, XLSX, JSON, and RDF.

This module was originally created for Textcavator, a web application that extracts data from a variety of datasets, indexes them and presents a search interface. To do this, we wanted a way to extract data from source files without having to write a new script "from scratch" for each dataset, and an API that would work the same regardless of the source file type.

The basic usage is that you will use the utilities in this package to create a "reader" class. You specify what your data looks like, and then call the documents() method of the reader to get an iterator of documents - where each document is a flat dictionary of key/value pairs.

Prerequisites

Requires Python 3.10 or later.

Contents

textcavator_readers contains the source code for the package. tests contains unit tests.

When to use this package

This package is not a replacement for more general-purpose libraries like csv or Beautiful Soup - it is a high-level interface on top of those libraries.

Our primary use for this package is to pre-process data for Textcavator, but you may find other uses for it.

Using this package makes sense if you want to extract data in the shape that it is designed for (i.e., a list of flat dictionaries).

What we find especially useful is that all subclasses of Reader have the same interface - regardless of whether they are processing CSV, JSON, XML, HTML, RDF or XLSX data. That common interface is crucial in an application that needs to process corpora from different source types, like Textcavator.

Usage

Typical usage of this package would be to make a custom Python class for a dataset from which you want to extract a list of documents. We call this a Reader. This package provides the base classes to structure readers, and provides extraction utilities for several file types.

For detailed usage documention and examples, visit textcavator-readers.readthedocs.io

If this site is unavailable, you can also generate the documentation site locally; see the contributing guide for insttructions.

Licence

This code is shared under an MIT licence. See LICENSE for more information.

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

textcavator_readers-0.5.1.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textcavator_readers-0.5.1-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file textcavator_readers-0.5.1.tar.gz.

File metadata

  • Download URL: textcavator_readers-0.5.1.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for textcavator_readers-0.5.1.tar.gz
Algorithm Hash digest
SHA256 37b1f7aef1212bdb0c3e5917a2d3a851130d9dfad798c3de7b5cab6362dbc3d3
MD5 36591bff1b21a33d869383da430bddf7
BLAKE2b-256 11ef4f1c200642e2f135d237d186f004d3a5f8f6310123036ac44501ac87f830

See more details on using hashes here.

Provenance

The following attestation bundles were made for textcavator_readers-0.5.1.tar.gz:

Publisher: release.yml on CentreForDigitalHumanities/textcavator-readers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file textcavator_readers-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for textcavator_readers-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ebb51a52698ecb25b15e1d07697825dcb8917abec5656a35076912ec287de139
MD5 0124c18f918a7679de4062b00cd6b39d
BLAKE2b-256 8e17ce01dad1a920d2730cd9e2992d6a79e41d54bcdf50898e06dc53250c7d92

See more details on using hashes here.

Provenance

The following attestation bundles were made for textcavator_readers-0.5.1-py3-none-any.whl:

Publisher: release.yml on CentreForDigitalHumanities/textcavator-readers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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