Skip to main content

HADES: Homologous Automated Document Exploration and Summarization

A powerful tool for comparing similarly structured documents

PyPI version Downloads

Overview

HADES is a Python package for comparing similarly structured documents. HADES is designed to streamline the work of professionals dealing with large volumes of documents, such as policy documents, legal acts, and scientific papers. The tool employs a multi-step pipeline that begins with processing PDF documents using topic modeling, summarization, and analysis of the most important words for each topic. The process concludes with an interactive web app with visualizations that facilitate the comparison of the documents. HADES has the potential to significantly improve the productivity of professionals dealing with high volumes of documents, reducing the time and effort required to complete tasks related to comparative document analysis.

Installation

Latest released version of the HADES package is available on Python Package Index (PyPI):

  1. Install spacy en-core-web-sm or en-core-web-lg model for English language according to the instructions

  2. Install HADES package using pip:

pip install -U hades-nlp

The source code and development version is currently hosted on GitHub.

Usage

The HADES package is designed to be used in a Python environment. The package can be imported as follows:

from hades.data_loading import load_processed_data
from hades.topic_modeling import ModelOptimizer, save_data_for_app, set_openai_key
from my_documents_data import PARAGRAPHS, COMMON_WORDS, STOPWORDS

The load_processed_data function loads the documents to be processed. The ModelOptimizer class is used to optimize the topic modeling process. The save_data_for_app function saves the data for the interactive web app. The set_openai_key function sets the OpenAI API key. my_documents_data contains the informations about the documents to be processed. The PARAGRAPHS variable is a list of strings that represent the paragraphs of the documents. The COMMON_WORDS variable is a list of strings that represent the most common words in the documents. The STOPWORDS variable is a list of strings that represent the most common words in the documents that should be excluded from the analysis.

First, the documents are loaded and processed:

set_openai_key("my openai key")
data_path = "my/data/path"
processed_df = load_processed_data(
    data_path=data_path,
    stop_words=STOPWORDS,
    id_column='country',
    flattened_by_col='my_column',
)

After the documents are loaded, the topic modeling process is optimized for each paragraph:

model_optimizers = []
for paragraph in PARAGRAPHS:
    filter_dict = {'paragraph': paragraph}
    model_optimizer = ModelOptimizer(
        processed_df,
        'country',
        'section',
        filter_dict,
        "lda",
        COMMON_WORDS[paragraph],
        (3,6),
        alpha=100
    )
    model_optimizer.name_topics_automatically_gpt3()
    model_optimizers.append(model_optimizer)

For each paragraph, the ModelOptimizer class is used to optimize the topic modeling process. The name_topics_automatically_gpt3 function automatically names the topics using the OpenAI GPT-3 API. User can also use the name_topics_manually function to manually name the topics.

Finally, the data is saved for the interactive web app:

save_data_for_app(model_optimizers, path='path/to/results', do_summaries=True)

The save_data_for_app function saves the data for the interactive web app. The do_summaries parameter is set to True to generate summaries for each topic.

When the data is saved, the interactive web app can be launched:

hades run-app --config path/to/results/config.json

Metadata

Release files for hades-nlp 0.1.2

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

Source distribution (sdist)

Source distribution for hades-nlp 0.1.2
File Size Uploaded Provenance Actions
hades_nlp-0.1.2.tar.gz 28.5 kB Without provenance Details for hades_nlp-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hades-nlp 0.1.2
File Interpreter ABI Platform Actions
hades_nlp-0.1.2-py3-none-any.whl Python 3 none any Details for hades_nlp-0.1.2-py3-none-any.whl

Total release size: 65.0 kB

Release files / hades_nlp-0.1.2.tar.gz

Download URL hades_nlp-0.1.2.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4f5b64c5618c37f96fe51f2322b3fc59c408240a2b679744816bef429823d9e7
BLAKE2b-256 checksum
How to use checksums
f99c0584f7eadeacc610312511a7ea840a2c34809236836ea557db99f8ef59c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.1 Windows/10

Release files / hades_nlp-0.1.2-py3-none-any.whl

Download URL hades_nlp-0.1.2-py3-none-any.whl
Size 36.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9e3ea412e38e6a696f044af12c38b8b7ea38940be6cf6545c5a7c78b4251f99
BLAKE2b-256 checksum
How to use checksums
b93f13386ae8829f65610f85db3fca35f8a00bf7796995e8187bea10e0b29096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.1 Windows/10

Security for hades-nlp 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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