F module - extract plain text from PDF and DOCX documents.
Find a file
flemming-it 6156cd5bd8
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 2s
ci: sign release bundles with FAI_SIGNING_KEY
Drop-in from fai/platform .forgejo/workflow-templates/
sign-bundle-keypair.yml. Triggers on v*.*.* tag push:
builds wasm32-wasip2, fetches the fai CLI from
get.fai.flemming.ai, packs the bundle, ECDSA P-256 signs
it against the org-level Forgejo secret FAI_SIGNING_KEY,
round-trip-verifies against infra/cosign/official.pub on
fai/platform main, and attaches bundle + .sig to the
Forgejo Release via the API.

Hubs configured with require_signatures: true now accept
this module's releases. Without the secret configured the
workflow fails fast with the setup instructions in stderr.

Signed-off-by: flemming-it <sf@flemming.it>
2026-05-28 23:14:01 +02:00
.forgejo/workflows ci: sign release bundles with FAI_SIGNING_KEY 2026-05-28 23:14:01 +02:00
src feat: initial text-extract v0.1.0 (text.extract@0.1.0) 2026-05-01 16:15:11 +02:00
tests feat: initial text-extract v0.1.0 (text.extract@0.1.0) 2026-05-01 16:15:11 +02:00
.gitignore feat: initial text-extract v0.1.0 (text.extract@0.1.0) 2026-05-01 16:15:11 +02:00
Cargo.lock ci: switch SDK to git dep, inject MODULE_SDK_PAT via insteadOf 2026-05-02 07:33:32 +02:00
Cargo.toml chore: SDK URL → git.flemming.ai/fai/module-sdk-rust 2026-05-26 13:16:53 +02:00
LICENSE feat: initial text-extract v0.1.0 (text.extract@0.1.0) 2026-05-01 16:15:11 +02:00
MODULE.de.md docs: add MODULE.md + MODULE.de.md inline docs 2026-05-25 14:06:04 +02:00
MODULE.md docs: add MODULE.md + MODULE.de.md inline docs 2026-05-25 14:06:04 +02:00
module.yaml chore(module): schema_version 2 + explicit provider 2026-05-28 11:48:25 +02:00
NOTICE feat: initial text-extract v0.1.0 (text.extract@0.1.0) 2026-05-01 16:15:11 +02:00
README.md feat: initial text-extract v0.1.0 (text.extract@0.1.0) 2026-05-01 16:15:11 +02:00
rust-toolchain.toml feat: initial text-extract v0.1.0 (text.extract@0.1.0) 2026-05-01 16:15:11 +02:00

text-extract

F∆I module — extract plain text from PDF and DOCX documents.

Capability

Field Value
Capability text.extract@0.1.0
Inputs document: bytes (PDF or DOCX)
Outputs extracted: json (ExtractedDocument)
Permissions none — pure in-WASM, no filesystem, no network
Status (in store index) alpha

Output schema

{
  "engine": "pdf-extract",
  "engine_version": "0.7",
  "pages": [
    { "number": 1, "text": "..." }
  ]
}

confidence and bbox per page are reserved for a future service-mode variant (host-services-backed pdfium/mupdf engine). v0.1.0 does not populate them; the schema accepts them as optional so that v0.2.0 can extend without an interface break.

Build

cargo build --release --target wasm32-wasip2
# Artifact: target/wasm32-wasip2/release/text_extract.wasm

The build depends on a sibling checkout of fai/module-sdk:

~/fai/
├── module_sdk/                 # cloned from fai/module-sdk
└── fai_modules/
    └── text-extract/           # this repo

This is a temporary path-based dependency. Once fai-module-sdk is published to a registry or a stable git tag, this module's Cargo.toml will switch over. The Forgejo CI workflow checks out the SDK repo into a sibling directory before building.

Test

cargo test                       # 9 tests: 6 unit + 3 integration
cargo test --release             # same, optimized

The DOCX path is covered end-to-end by an integration test that builds a minimal valid DOCX in memory and feeds it through invoke. The PDF path is covered by unit tests on the page splitter; full PDF coverage will land once the platform's hub loads this wasm component as part of its store-install integration test.

Limitations of v0.1.0

  • Layout-naive PDF parsing. Multi-column layouts and tables may produce reordered text. Single-column documents work reliably.
  • DOCX text only. Tables, footnotes, headers/footers and embedded objects are not yet extracted. Plain paragraph text with run-level concatenation is the v0.1.0 surface.
  • No OCR. Image-only PDFs return empty text per page. An OCR variant will arrive as a separate module (text.ocr@x.y.z) once the host-services infrastructure for tesseract is in place.

License

Apache-2.0. See LICENSE.

Author: Dr. Stefan Flemming, Flemming.AI platform@flemming.ai Repository: https://git.flemming.ws/fai-modules/text-extract