Skip to main content

No project description provided

Project description

PDF and Web Content Query Package

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 semanticbot

Replace semanticbot with the actual name of your package.

Usage

Processing a PDF

To process a PDF file and query its content:

from your_package_name import process_pdf

pdf_path = "path/to/your/file.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}")
    print(f"Text chunk: {chunk}
")

Crawling and Querying a Web Page

To crawl a web page and query its content:

from your_package_name import crawl_and_query

url = "https://example.com"
query = "What are the key features of the product?"

results = crawl_and_query(url, query)

for chunk, similarity in results:
    print(f"Similarity: {similarity}")
    print(f"Text chunk: {chunk}
")

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

semanticbot-0.4.7.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

semanticbot-0.4.7-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file semanticbot-0.4.7.tar.gz.

File metadata

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

File hashes

Hashes for semanticbot-0.4.7.tar.gz
Algorithm Hash digest
SHA256 88b5f9a2949b55dec4320d7510af594e080833e6deb97205dc3e4a3ba3816e6c
MD5 f3cfbba928cf9f41c58710e3d4a3a6d9
BLAKE2b-256 a32d609c6ee4a83a4c35a73c25654fd52344756f8f1fb047ffddfa78e17d5a49

See more details on using hashes here.

File details

Details for the file semanticbot-0.4.7-py3-none-any.whl.

File metadata

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

File hashes

Hashes for semanticbot-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a1ac589748951abbe0615db2fa32f9220a8ccb0bf24b81f2ea142e03cc1dcea7
MD5 d69fe9a47d0c49b692fe604340d53c4a
BLAKE2b-256 e97a33c16d0c2dec1492a2aadaf7c2a348ce1b007fd2d32eda5aefee85c0c5f0

See more details on using hashes here.

Supported by

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