Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add SpaCy Processor for Enhanced NLP Support in Quivr #3468

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Sahil-2101
Copy link

Description

This pull request introduces the SpaCyProcessor class to handle various text file types (PDF, DOCX, TXT, and CSV) and perform NLP processing using spaCy. This addition includes:

Key Features:

  • File Extraction: Supports asynchronous text extraction from PDFs using fitz (PyMuPDF), DOCX files via python-docx, and handling of TXT and CSV files.
  • NLP Processing: Integrates spaCy's NLP pipeline for entity recognition and sentence tokenization, adding metadata on entities and sentences in each document chunk.
  • Document Chunking: Implements RecursiveCharacterTextSplitter to divide documents into manageable chunks with specified overlap, ensuring consistent chunk sizes.
  • Error Handling and Logging: Provides robust logging for extraction errors and validation checks, improving traceability.

Motivation:
This feature adds support for spaCy NLP processing to enable richer text analysis and processing across various file types. The processor now efficiently handles different file formats, extracts meaningful text, and applies NLP, making it easier to work with structured document data in downstream applications.

Checklist before requesting a review

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Screenshots (if appropriate):

- Introduced SpaCyProcessor to handle various file formats (PDF, DOCX, TXT, CSV)
- Supports recursive text splitting for chunked processing
- Applies spaCy NLP pipeline for tokenization and entity recognition on file content
…sing

- Added support for PDF, DOCX, TXT, and CSV file extraction using fitz (PyMuPDF) and python-docx.
- Integrated spaCy NLP pipeline for entity recognition and sentence tokenization.
- Configured RecursiveCharacterTextSplitter for document chunking with metadata (chunk size, entities, sentences).
- Added error handling and logging for robust file processing and validation.
- Improved support for asynchronous text extraction, enabling efficient file reading.
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 12, 2024
@Sahil-2101 Sahil-2101 changed the title Add SpaCy Processor for Enhanced NLP Support in Quivr feat: Add SpaCy Processor for Enhanced NLP Support in Quivr Nov 12, 2024
@StanGirard
Copy link
Collaborator

Very nice PR! We'll take a closer look :) @AmineDiro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants