From fdb5deaa8bb8afa15f579744b0df4075022e7fd6 Mon Sep 17 00:00:00 2001 From: flemming-it Date: Mon, 25 May 2026 14:06:04 +0200 Subject: [PATCH] docs: add MODULE.md + MODULE.de.md inline docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Studio reads MODULE.md / MODULE..md from the installed bundle and renders it in the module-detail Documentation section. text-extract ships them now — EN+DE peers, same schema as the README but trimmed for the in-app reader. Signed-off-by: flemming-it --- MODULE.de.md | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++ MODULE.md | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 188 insertions(+) create mode 100644 MODULE.de.md create mode 100644 MODULE.md diff --git a/MODULE.de.md b/MODULE.de.md new file mode 100644 index 0000000..bd60e14 --- /dev/null +++ b/MODULE.de.md @@ -0,0 +1,96 @@ +# text.extract + +Reine Textextraktion aus PDF- und DOCX-Dokumenten. Pure-Rust, +in-WASM, ohne deklarierte Berechtigungen. Der kanonische erste +Schritt in Flows, die Rohtext brauchen — anonymisieren, +zusammenfassen, übersetzen, per LLM klassifizieren, +Audit-redigieren. + +## Capability + +- `text.extract@0.1.0` + +## Eingaben + +| Name | Typ | Beschreibung | +| ---------- | ----- | ------------------------------------------------------- | +| `document` | bytes | Das zu extrahierende Dokument. MIME-Typen siehe unten. | + +Akzeptierte MIME-Typen (deklariert in +`module.yaml#accepts_mime`, von Studio als File-Picker-Filter +gelesen): + +- `application/pdf` +- `application/x-pdf` +- `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + +Andere MIME-Typen werden mit `invalid_input` abgelehnt — vor +jedem Parsen. + +## Ausgabe + +| Name | Typ | Beschreibung | +| ----------- | ---- | --------------------------------------------- | +| `extracted` | json | `ExtractedDocument`-Schema siehe unten. | + +```json +{ + "engine": "pdf-extract", + "engine_version": "0.7", + "pages": [ + { "number": 1, "text": "…" } + ] +} +``` + +`confidence` und `bbox` pro Seite sind im Schema für eine +spätere Service-Mode-Variante (pdfium / mupdf via +Host-Services) reserviert. v0.1.0 setzt diese Felder nicht; +das Schema akzeptiert sie als optional. + +## Berechtigungen + +Keine. Reine Rust-Pipeline (`pdf-extract`, `zip`, `quick-xml`). +Kein Dateisystem, kein Netz. `permissions: []` in +`module.yaml` macht das explizit; der Hub erzwingt es. + +## Grenzen in v0.1.0 + +- **Layout-naives PDF.** Mehrspaltige oder tabellenlastige + Dokumente können umsortierten Text liefern. Ein-Spalten- + Fließtext ist solide. +- **Kein OCR.** Gescannte (nur-Bild-)PDFs liefern pro Seite + leeren Text. Künftiges `text.ocr@^0` als Vor-Schritt. +- **Nur DOCX bei Office.** `.doc` (Altformat), `.rtf`, `.odt` + noch nicht unterstützt. + +`1.0.0` setzt entweder die Service-Mode-Variante +(pdfium-Qualität + Layout) voraus oder einen +nachgewiesen-guten Extraktions-Score auf einem +repräsentativen Korpus. + +## Beispiel-Flow + +```yaml +name: extract-anonymise +inputs: + document: bytes +steps: + - id: extract + use: text.extract@^0 + with: + document: $inputs.document + - id: redact + use: text.anonymize@^0 + with: + text: $extract.extracted.pages[*].text +outputs: + redacted: $redact.anonymized +``` + +## Build + +```bash +cargo build --release --target wasm32-wasip2 +# Ausgabe: target/wasm32-wasip2/release/text_extract.wasm +``` diff --git a/MODULE.md b/MODULE.md new file mode 100644 index 0000000..5871e48 --- /dev/null +++ b/MODULE.md @@ -0,0 +1,92 @@ +# text.extract + +Plain-text extraction from PDF and DOCX documents. Pure-Rust, +in-WASM, no permissions required. The canonical first step in +any flow that needs raw text — anonymise, summarise, translate, +LLM-classify, audit-redact. + +## Capability + +- `text.extract@0.1.0` + +## Inputs + +| Name | Type | Description | +| ---------- | ----- | ------------------------------------------------------ | +| `document` | bytes | The document to extract. Accepted MIME types below. | + +Accepted MIME types (declared in `module.yaml#accepts_mime`, +read by Studio as the file-picker filter): + +- `application/pdf` +- `application/x-pdf` +- `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + +Other MIME types are rejected with a `invalid_input` error +before any parsing happens. + +## Output + +| Name | Type | Description | +| ----------- | ---- | ------------------------------------------------- | +| `extracted` | json | `ExtractedDocument` schema below. | + +```json +{ + "engine": "pdf-extract", + "engine_version": "0.7", + "pages": [ + { "number": 1, "text": "…" } + ] +} +``` + +Per-page `confidence` and `bbox` fields are reserved in the +schema for a future service-mode variant (pdfium / mupdf via +host services) that surfaces layout information. v0.1.0 does +not populate them; the schema accepts them as optional. + +## Permissions + +None. Pure-Rust pipeline (`pdf-extract`, `zip`, `quick-xml`). +No filesystem, no network. The empty `permissions: []` in +`module.yaml` makes that explicit; the hub enforces it. + +## Limits in v0.1.0 + +- **Layout-naive PDF.** Multi-column or table-heavy documents + may produce reordered text. Single-column body text is solid. +- **No OCR.** Scanned (image-only) PDFs return empty text per + page. Pair with a future `text.ocr@^0` step for those. +- **DOCX-only Office.** `.doc` (legacy binary), `.rtf`, `.odt` + are not yet supported. + +Bumping to `1.0.0` requires either the service-mode variant +(pdfium-quality output + layout) or a confirmed-good extraction +score on a representative corpus. + +## Example flow + +```yaml +name: extract-anonymise +inputs: + document: bytes +steps: + - id: extract + use: text.extract@^0 + with: + document: $inputs.document + - id: redact + use: text.anonymize@^0 + with: + text: $extract.extracted.pages[*].text +outputs: + redacted: $redact.anonymized +``` + +## Build + +```bash +cargo build --release --target wasm32-wasip2 +# Output: target/wasm32-wasip2/release/text_extract.wasm +```