FLAMEHAVEN FileSearch extracts plain UTF-8 text from 34 file extensions using a layered stack of internal and optional parsers. No external document-AI framework is required.
| Extension(s) | Parser | Extra Required |
|---|---|---|
.pdf |
pymupdf → pypdf fallback | [parsers] |
.docx .dotx .docm .dotm |
python-docx (tables included) | [parsers] |
.doc |
antiword → python-docx fallback | [parsers] + antiword binary |
.xlsx .xlsm |
openpyxl (all sheets) | [parsers] |
.pptx .potx .ppsx .pptm |
python-pptx (tables + shapes) | [parsers] |
.rtf |
striprtf | [parsers] |
.html .htm .xhtml |
Internal html.parser extractor | None |
.vtt |
Internal WebVTT regex parser | None |
.tex .latex |
Internal LaTeX regex stripper | None |
.csv |
Internal csv.Sniffer parser | None |
.jpg .jpeg .png .tif .tiff .bmp .webp |
pytesseract OCR | [vision] |
.md .txt .text .qmd .rmd |
Plain UTF-8 read | None |
from flamehaven_filesearch.engine.file_parser import extract_text
text = extract_text("report.pdf") # PDF
text = extract_text("slides.pptx") # PowerPoint
text = extract_text("data.csv") # CSV — auto-detects delimiter
text = extract_text("page.html") # HTML — strips scripts/styles
text = extract_text("subs.vtt") # WebVTT — strips timestamps
text = extract_text("paper.tex") # LaTeX — strips commandsUses Python's stdlib html.parser.HTMLParser.
- Suppresses
<script>,<style>,<head>,<noscript>content entirely. - Block tags (
<p>,<div>,<h1>–<h6>,<li>,<tr>, etc.) produce newlines preserving paragraph structure. - HTML entities decoded via
convert_charrefs=True. - Collapses 3+ consecutive newlines to a single blank line.
Implements the W3C WebVTT spec via regex.
- Skips the
WEBVTTfile signature. - Skips
NOTE,STYLE, andREGIONblocks. - Detects timestamp lines (
HH:MM:SS.mmm --> HH:MM:SS.mmm) and enters cue mode. - Strips inline cue tags:
<b>,</i>,<c.color>,<00:01:02.000>. - Returns speaker text as newline-separated plain text.
# Input (.vtt)
WEBVTT
00:00:01.000 --> 00:00:04.000
Hello <b>world</b>
# Output
Hello world
Regex-based text extraction pipeline (6 passes):
- Strip
%line comments. - Remove display environments:
equation,align,gather,figure,table,tikzpicture, and their*variants. - Promote
\section{},\chapter{},\title{}to plain headings. - Unwrap inline commands:
\textbf{},\textit{},\emph{},\mbox{}. - Extract
\item,\cite,\footnotearguments. - Remove all remaining
\commandsand strip{}$&_^~characters.
Uses csv.Sniffer for automatic delimiter detection (,, ;, \t, |, :).
Falls back to comma on detection failure. Returns tab-separated rows.
For RAG pipelines, split extracted text into structured chunks:
from flamehaven_filesearch.engine.text_chunker import chunk_text
text = extract_text("report.pdf")
chunks = chunk_text(text, max_tokens=512, min_tokens=64, merge_peers=True)
for chunk in chunks:
print(chunk["text"]) # str — chunk content
print(chunk["headings"]) # list — parent heading hierarchy
print(chunk["pages"]) # list — page numbers (empty for non-PDF plain text)1. Markdown heading split → sections by # / ## / ### boundaries
2. Paragraph split → \n\n within each section
3. Sentence split → [.!?] boundaries for oversized paragraphs
4. Merge small chunks → merge_peers: chunks < min_tokens merged with successor
Token estimation: words × 0.75 (conservative for sub-word tokenizers).
| Parameter | Default | Notes |
|---|---|---|
max_tokens |
512 | Maximum tokens per chunk |
min_tokens |
64 | Minimum before merge attempt |
merge_peers |
True | Merge undersized trailing chunks |
Since v1.5.0, the upload pipeline embeds file content rather than metadata:
# Before v1.5.0 (broken for local mode)
embed_text = f"{filename} {filetype}" # meaningless for semantic search
# v1.5.0+
content = extract_text(file_path)
embed_text = content[:2000] if content else f"{filename} {filetype}"
vector = embedding_generator.generate(embed_text)This fixes semantic search quality for all non-Gemini-API code paths.
# PDF + DOCX + XLSX + PPTX + RTF parsers
pip install flamehaven-filesearch[parsers]
# Image OCR (requires Tesseract binary: https://github.com/tesseract-ocr/tesseract)
pip install flamehaven-filesearch[vision]
# macOS: brew install tesseract
# Ubuntu: apt-get install tesseract-ocr
# Windows: https://github.com/UB-Mannheim/tesseract/wiki