Skip to content

Repository files navigation

Veritium

Lightweight cross-platform tool for correcting MinerU OCR texts

Version Platform Flutter License

Veritium UI

Features

  • 📄 Load and correct _middle.json files generated by MinerU OCR
  • 🖼️ Side-by-side view of the original image and editable text
  • 🔀 Toggle between original and span overlay views
  • 🚩 Flag items for review
  • 💬 Add comments to any bounding box
  • 💾 Auto-save corrections back to the JSON file
  • 🧰 Export _middle.json to Markdown from UI, Dart CLI, or Windows app binary CLI mode
  • ⌨️ Extensive keyboard shortcuts for efficient workflow
  • 🔍 Go to any item by number
  • 📐 Adjustable UI scale for different screen sizes

Installation

You can download the latest release from the GitHub Releases page.

Development

Dependencies:


Usage

  1. Load a file — Open the app and select File > Load JSON, then choose the _middle.json file generated by MinerU OCR.
  2. Edit text — The recognized text appears alongside the cropped image. Make corrections in the text field.
  3. Navigate — Use the arrow buttons or keyboard shortcuts to move between items.
  4. Flag & Comment — Mark items for review with the flag button or add comments via the comment button.
  5. Export Markdown — Use File > Export Markdown to export the loaded _middle.json into markdown.
  6. Save — Click the save icon (or press Ctrl+S) to write changes back to the JSON file. They are saved as 'corrected_content' fields in each line.

CLI Export

You can export a MinerU _middle.json file to markdown without launching the UI:

Dart CLI command

dart run bin/export_markdown.dart --input examples/straza/id-40086785_date-19091112_vol-01_no-132_middle.json --output build/cli_export_test.md

Windows Flutter binary command

After building Windows, you can call the app binary directly in CLI mode:

veritium.exe --cli-export --input examples\straza\id-40086785_date-19091112_vol-01_no-132_middle.json --output build\windows_cli_export.md --no-images

--cli-export is the explicit switch for binary CLI mode.

Options:

  • --input / -i (required): path to _middle.json
  • --output / -o (optional): output markdown path
  • --no-images (optional): skips markdown image entries from image blocks
  • --original-content (optional): prefer original OCR content instead of corrected_content
  • --lists-as-text (optional): renders list blocks as plain text instead of markdown bullet lines
  • --all-as-text (optional): renders titles, lists, and image paths as plain text (no markdown syntax)
  • --block-separator (optional): double (default) uses a blank line between blocks, single uses one newline
  • --skip-flagged (optional): skips blocks where is_flagged (or flagged) is set to true
  • --skip-hashes (optional): path to text file with hashes to skip (one hash per line)
  • --skip-hashes-mode (optional): span (default) removes matching spans only, line removes whole lines containing matching hashes
  • --help / -h: show CLI help

By default, markdown export prefers corrected text (corrected_content) and falls back to original content when corrected text is missing.

By default, list blocks are exported as markdown bullet lines. Use --lists-as-text to export list blocks as plain text.

Use --all-as-text to force all supported block content into plain text output.

Use --block-separator single if you want a single newline between exported blocks.

If --output is omitted, output is created next to the input file using the same base name and .md extension.

CLI Export Empty Corrected Hashes

You can export span hashes where corrected_content field is present and empty:

dart run bin/export_empty_corrected_hashes.dart --input examples/straza/id-40086785_date-19091112_vol-01_no-132_middle.json --output build/empty_corrected_hashes.txt

After building Windows, you can call the app binary directly in hash export CLI mode:

veritium.exe --cli-export-empty-hashes --input examples\straza\id-40086785_date-19091112_vol-01_no-132_middle.json --output build\empty_corrected_hashes.txt

--cli-export-empty-hashes is the explicit switch for binary hash export mode.

Options:

  • --input / -i (required): path to _middle.json
  • --output / -o (optional): output text file path
  • --help / -h: show CLI help

Notes:

  • Only spans with a non-empty hash are included.
  • A hash is exported only if corrected_content field is present and empty after trimming.
  • Duplicate hashes are preserved in output order.

Automated Testing

  • flutter test covers CLI behavior (test/cli_export_test.dart) and markdown export logic.
  • GitHub Actions runs:
    • Dart CLI smoke test in Linux CI
    • Windows binary CLI smoke test in the Windows release build job

Keyboard Shortcuts

Shortcut Action
F7 / Alt + ← Previous item
F8 / Alt + → Next item
Ctrl + S Save corrected JSON
Ctrl + F Toggle flag on current item
Ctrl + T Add comment
Ctrl + G Go to item
Ctrl + = / Ctrl + + Increase UI scale
Ctrl + - Decrease UI scale

💡 Press File > Show Keyboard Shortcuts in the app for a full list.

Changelog

See CHANGELOG.md for release history and details.

Documentation

Internal source map and major function reference: docs/README.md

Contributing

Contributions, issues, and feature requests are welcome!

In case you have issues after updating Visual Studio to the latest version, do the following:

rm -rf ./build
flutter clean
flutter pub get

Afterwards, it should work again without any issues. As normally, to start the app, run flutter run in the root directory.

License

This project is licensed under the MIT License.

About

Lightweight cross-platform Flutter-based tool for correcting MinerU OCR texts

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages