Skip to main content

No project description provided

Project description

PDF and Web Content Query Package With FAISS And Cosine Similarity

License

This package provides functionality to process PDF files and web pages, allowing users to query their content using natural language processing techniques.

Table of Contents

Features

  • Process PDF files and answer queries about their content
  • Crawl web pages and answer queries about their content
  • Utilizes advanced embedding techniques for accurate content matching

Installation

To install this package, run:

pip install synapseai

Replace synapseai with the actual name of your package.

Usage

Processing a PDF

from synapseai import process_pdf

pdf_path = "path/to/your/document.pdf"
query = "What is the main topic of this document?"

results = process_pdf(pdf_path, query)

for chunk, similarity in results:
    print(f"Similarity: {similarity:.4f}")
    print(f"Chunk: {chunk[:200]}...")  # Print first 200 characters
    print("-" * 50)

Crawling and Querying a Web Page

To crawl a web page and query its content:

from synapseai import crawl_and_query

url = "https://example.com"
query = "What services does this website offer?"

results = crawl_and_query(url, query)

for chunk, similarity in results:
    print(f"Similarity: {similarity:.4f}")
    print(f"Chunk: {chunk[:200]}...")  # Print first 200 characters
    print("-" * 50)

How It Works

  • For PDFs: The package extracts text content from the file.
  • For Web Pages: It crawls the specified URL and extracts the text content.
  • The extracted text is split into manageable chunks.
  • The package uses HuggingFace's BGE embeddings to convert text chunks and the query into vector representations.
  • Cosine similarity is used to find the most relevant text chunks for the given query.
  • The top 5 most relevant chunks are returned along with their similarity scores.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

synapseai-0.5.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

SynapseAI-0.5.3-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file synapseai-0.5.3.tar.gz.

File metadata

  • Download URL: synapseai-0.5.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for synapseai-0.5.3.tar.gz
Algorithm Hash digest
SHA256 a795e5ad5f6b108f4738f588c99eadee32c7f52fb07f2bcf8ef60bb3ab22a740
MD5 39ca97794aad37289cda605dee01d121
BLAKE2b-256 e80cfa8c134361a45634d9f65fabb2a3039ac77a9b70b7739c5e6510b23116ee

See more details on using hashes here.

File details

Details for the file SynapseAI-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: SynapseAI-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for SynapseAI-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b5413d96b579cf4893f5f3ae6bd1ddb7ed9247611f7cc62c491a0736c047819e
MD5 3dde311c494cac7b09cfb988216625ec
BLAKE2b-256 3089bc55a8fc8d1e5639d8c97095724480b3e02dc26f5f26518dae015e48ab75

See more details on using hashes here.

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