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.2.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.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: synapseai-0.5.2.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.2.tar.gz
Algorithm Hash digest
SHA256 fd10f2de5085329c7d51afbf102f6c893b3b308e56ae184f2bd2f3f89633b0fe
MD5 bb32815975a23e65cdc70682e09e6c51
BLAKE2b-256 ceef286820c050b156458fe58e365e567d9b1dfb5d4ff5d65151db3a5ab01f19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SynapseAI-0.5.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d11bd2557c32159fd1e88b83cfb800acf8d8cf3649a6e5b24d8cf6fa5e366d26
MD5 9493af55d4d2dcb6923f79544542ad3e
BLAKE2b-256 c7d3d2eecdd51af890a0154e0c992270cf6831f110e619fa708874bad22db3d9

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