- Rust 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| src | ||
| tests | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| COPYING | ||
| icon.svg | ||
| README.md | ||
KOBO Words
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.sqlitedatabase 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
--defineflag 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
- Run the tool to produce
kobo_words.apkg. - In Anki open File → Import… and select the
.apkgfile. - 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 theWordListtable (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-enfor Spanish→English) is recorded inDictSuffix, and can be shown on the back instead using--dictionary-code. - Older firmware (
Kobo.sqlite): lookups live in thecontenttable withBookmarkType = 4, and each record's word/definition is stored as JSON in theExtraDatacolumn.
In both cases the tool then:
- Extracts the saved words (words are normalised to Title Case and deduplicated case-insensitively).
- Strips HTML from definitions where present.
- 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
--defineto fetch definitions online, or--dictionary-codeto instead show which dictionary was used (e.g.-es-en). --defineuses either the localdictCLI 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
--dbat the right file or adjust the query. - Use
--deletewith 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.