Simple CLI tool that extracts the words you have saved on your Kobo Ereader and turns them in to Anki Flashcards for further review.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Anthony Mills dc0854bc28
All checks were successful
CI / lint (push) Successful in 1m3s
CI / test (push) Successful in 1m9s
feat: add definition lookups with selectable dict provider and rate-limit retry
2026-10-25 13:50:42 +11:00
.forgejo/workflows Added some test coverage. 2026-10-25 12:36:01 +11:00
src feat: add definition lookups with selectable dict provider and rate-limit retry 2026-10-25 13:50:42 +11:00
tests feat: add definition lookups with selectable dict provider and rate-limit retry 2026-10-25 13:50:42 +11:00
.gitignore Initial commit. 2026-10-25 12:26:27 +11:00
Cargo.lock feat: add definition lookups with selectable dict provider and rate-limit retry 2026-10-25 13:50:42 +11:00
Cargo.toml feat: add definition lookups with selectable dict provider and rate-limit retry 2026-10-25 13:50:42 +11:00
COPYING Initial commit. 2026-10-25 12:26:27 +11:00
icon.svg Initial commit. 2026-10-25 12:26:27 +11:00
README.md feat: add definition lookups with selectable dict provider and rate-limit retry 2026-10-25 13:50:42 +11:00

KOBO Words

Cartoon e-reader icon

Build status License: GPL v3

A simple Rust command-line tool that extracts the words you've saved while reading on your Kobo e-reader and turns them into Anki flashcards.

When you look up a word in the built‑in dictionary on a Kobo and save it to your word list, the device stores the word and its definition in a local SQLite database. This tool reads that database, pulls out every saved word pair, and packages it into a proper Anki .apkg deck that imports straight into Anki.

Features

  • SQLite extraction — reads the Kobo .kobo/Kobo.sqlite database directly.
  • Smart cleanup — HTML is stripped from definitions and duplicate words are removed.
  • Real Anki decks — writes a genuine .apkg (SQLite collection + media) using a Basic Front/Back note type, so it imports cleanly on desktop, Android, iPhone, web and AnkiMobile.
  • Optional online definitions — the --define flag fetches real definitions from Wiktionary and puts them on the back of the cards.
  • Optional device cleanup — a flag lets you delete the exported words from the device after a successful export.

Requirements

  • A Kobo e-reader mounted via USB (or a copy of its Kobo.sqlite / KoboReader.sqlite).
  • Rust toolchain.

Building

cargo build --release

The binary will be at target/release/kobo-words.

Testing

cargo test

Runs the unit test suite covering SQLite extraction, deduplication, HTML stripping, the delete-after-export behaviour, and .apkg generation.

cargo clippy --all-targets -- -D warnings

Lints the code and tests (this is what the CI lint job runs).

Usage

kobo-words [OPTIONS]

Options

Flag Description
-d, --db <PATH> Path to the Kobo.sqlite database. If omitted, auto-detects common mount points (/media/.kobo/Kobo.sqlite, /mnt/.kobo/Kobo.sqlite) or Kobo.sqlite in the current directory.
-o, --output <FILE> Output path for the generated .apkg deck. Defaults to kobo_words.apkg.
-D, --delete Delete the exported words from the device after a successful export.
--dictionary-code Put the dictionary pair used for each lookup (e.g. -es-en) on the back of cards instead of leaving it blank.
--define Look up each word's definition and put it on the back (sees --dictionary for the provider).
--dictionary <NAME> Dictionary provider for --define: auto (use the local dict CLI if installed, else Wiktionary online), wiki, or dict. Defaults to auto.
-h, --help Show help.
-V, --version Show version.

Examples

Export words and save the deck to kobo_words.apkg:

kobo-words

Export from a specific database path and choose the output file:

kobo-words --db /mnt/.kobo/Kobo.sqlite --output my_export_2026.apkg

Export words and remove them from the device afterwards:

kobo-words --delete

Export words with their real definitions fetched:

kobo-words --define                         # auto: local `dict`, else Wiktionary
kobo-words --define --dictionary wiki       # Wiktionary online
kobo-words --define --dictionary dict       # the local `dict` command

Importing into Anki

  1. Run the tool to produce kobo_words.apkg.
  2. In Anki open File → Import… and select the .apkg file.
  3. The cards use the standard Basic note type: the word is the Front and the cleaned definition is the Back.

How it works

Saved words are stored in different tables depending on the Kobo firmware version, so the tool auto-detects which schema is present:

  • Newer firmware (KoboReader.sqlite): words live in the WordList table (Text, DictSuffix, DateCreated). Only the word itself is stored — no definition — so the front of the card is the word and the back is left blank for you to fill in. The dictionary pair used for each lookup (e.g. -es-en for Spanish→English) is recorded in DictSuffix, and can be shown on the back instead using --dictionary-code.
  • Older firmware (Kobo.sqlite): lookups live in the content table with BookmarkType = 4, and each record's word/definition is stored as JSON in the ExtraData column.

In both cases the tool then:

  1. Extracts the saved words (words are normalised to Title Case and deduplicated case-insensitively).
  2. Strips HTML from definitions where present.
  3. Builds a minimal but valid Anki collection and zips it into an .apkg.

Notes / Limitations

  • On newer firmware the device does not store definitions for saved words, so those cards are created with a blank back that you fill in within Anki. Use --define to fetch definitions online, or --dictionary-code to instead show which dictionary was used (e.g. -es-en).
  • --define uses either the local dict CLI or Wiktionary (en.wiktionary.org), controlled by --dictionary. Wiktionary lookups retry with back-off when rate-limited (HTTP 429). Words that cannot be resolved are left with a blank back, and the export still succeeds.
  • The exact database schema can differ slightly between firmware versions and device models. If your device stores word lists elsewhere, point --db at the right file or adjust the query.
  • Use --delete with care: it permanently removes the exported words from the device database. It only runs after the deck has been written successfully.

License

This project is licensed under the GNU General Public License v3.0. See the COPYING file for details.