Feature: Extend Support for Multiple File Types in OCR/Extraction Service #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request implements the enhancements outlined in issue #3: "Extend Support for Multiple File Types in OCR/Extraction Service". It significantly expands the file type support beyond the current PDF, DOCX, and PPTX formats.
Changes
Added Support for New File Types:
Microsoft Office Formats:
.DOC(older Word format) using docx2txt.XLSX(Excel) using openpyxl.XLS(older Excel format) using xlrdOpenDocument Formats:
.ODT(OpenDocument Text) using odfpy.ODS(OpenDocument Spreadsheet) using odfpy.ODP(OpenDocument Presentation) using odfpyText Formats:
.TXTfiles.RTFfiles using striprtfE-book Format:
.EPUBformat using ebooklib and BeautifulSoup4Implementation Details:
New Extraction Functions:
extract_text_from_doc()for DOC filesextract_text_from_xlsx()andextract_text_from_xls()for Excel filesextract_text_from_odt(),extract_text_from_ods(), andextract_text_from_odp()for OpenDocument formatsextract_text_from_txt()andextract_text_from_rtf()for text formatsextract_text_from_epub()for EPUB filesFile Type Detection:
__init__.pyfor both URL and local file pathschunking_routes.pyfor API uploadsProcessing Logic:
process_document_chunking()inservices/chunking.pyto handle all new file typesDependencies:
requirements.txt:setup.pywith the same dependenciesDocumentation:
Testing
All new file type extraction functions have been implemented with proper error handling and logging. The implementation follows the same patterns as the existing extraction functions for PDF, DOCX, and PPTX.
Resolves
This PR resolves issue #3: "Extend Support for Multiple File Types in OCR/Extraction Service"
/claim #3