Apache Tika
Overview
- Universal Parser: It acts as a single interface to parse many different document formats, simplifying the process of handling varied content.
- Broad File Format Support: Tika supports over a thousand file formats, including Microsoft Office documents (Word, Excel), PDFs, images (extracting EXIF data), audio, video, and archives (like .zip).
- Automatic Type Detection: It can automatically determine a file's type based on its content, not just its file extension, ensuring the correct parser is used.
- Extracts Text and Metadata: Its primary function is to pull out the main body text (content) and structured metadata (e.g., author, title, creation date, GPS coordinates from an image).
- Language Detection: It can also identify the natural language of the extracted text.
Up and Running
podman run -d \
--name tika \
--network llm-stack \
-p 127.0.0.1:9998:9998 \
apache/tika:3.2.1.0
podman logs -f tika
Usage
# Download sample PDF
curl -o sample.pdf https://www.dartmouth.edu/hr/docs/employment/samplequestions.pdf
# Extract text content
curl -H "Accept: text/plain" -T sample.pdf http://localhost:9998/tika
# Extract metadata
curl -H "Accept: application/json" -T sample.pdf http://localhost:9998/meta | jq