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.4.tar.gz (4.1 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.4-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: synapseai-0.5.4.tar.gz
  • Upload date:
  • Size: 4.1 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.4.tar.gz
Algorithm Hash digest
SHA256 90f8263188d36f106ebdc90d4e0a576c1c7b88d703963e97ba4b479b5a2f3c96
MD5 1d924b5e248ea4ffd75b06e24fa3c383
BLAKE2b-256 0b38d79f627454ef7e15d7c9bd9f215e445507a31f13a26ac329febce6331880

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SynapseAI-0.5.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 67d46ef6bd7fbc090bfdc5389a7680109a34432bb8a9a1fc99130355538e2237
MD5 b1e73d2d968e5c5a2b0108765a1db9d7
BLAKE2b-256 05158f2e3b76a10c6390379086256b961377da57ccb1c1645abac18503de688a

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