All plugins

offline-dict

Lets the agent look words up in dictionaries on this machine without internet access, in the two open formats offline dictionaries ship in: dictd (.index + .dict/.dict.dz, the DICT protocol's format: FreeDict, GCIDE, WordNet and Linux dict-* packages) and StarDict (.ifo + .idx + .dict.dz, with .syn alternate spellings). FreeDict alone publishes about 300 bilingual dictionaries in both. dict_list lists the dictionaries found under plugins.entries.offline-dict.settings.paths, dict_define returns every definition of a word as plain text (case ignored; when nothing matches exactly, headwords that differ only in accents, punctuation or spaces, marked loose; otherwise suggestions one typing slip away), in parts, and dict_match finds headwords by prefix, exact, substring, suffix, word or lev (one typing slip off) matching, like the DICT protocol's MATCH. Standard library only; dictzip files are read by chunk. Not affiliated with the DICT Development Group, StarDict, FreeDict or GNU. Disclosure — reads only the dictionary files under the paths you configure (folders are listed to find .index and .ifo files); writes nothing, keeps nothing between calls, makes no network calls, needs no credentials and runs no commands. Definitions are returned as the dictionary's authors wrote them, with HTML and other markup reduced to text.

nftpoetristToolsv0.1.0Updated 2 hours ago

About

Lets the agent look words up in dictionaries on this machine without internet access, in the two open formats offline dictionaries ship in: dictd (.index + .dict/.dict.dz, the DICT protocol's format: FreeDict, GCIDE, WordNet and Linux dict-* packages) and StarDict (.ifo + .idx + .dict.dz, with .syn alternate spellings). FreeDict alone publishes about 300 bilingual dictionaries in both. dict_list lists the dictionaries found under plugins.entries.offline-dict.settings.paths, dict_define returns every definition of a word as plain text (case ignored; when nothing matches exactly, headwords that differ only in accents, punctuation or spaces, marked loose; otherwise suggestions one typing slip away), in parts, and dict_match finds headwords by prefix, exact, substring, suffix, word or lev (one typing slip off) matching, like the DICT protocol's MATCH. Standard library only; dictzip files are read by chunk. Not affiliated with the DICT Development Group, StarDict, FreeDict or GNU. Disclosure — reads only the dictionary files under the paths you configure (folders are listed to find .index and .ifo files); writes nothing, keeps nothing between calls, makes no network calls, needs no credentials and runs no commands. Definitions are returned as the dictionary's authors wrote them, with HTML and other markup reduced to text.

hermes-offline-dict

A Hermes Agent plugin that lets the agent look words
up in dictionaries on your own machine, without internet access. It reads the two open formats
offline dictionaries are published in:

  • dictd (the format behind the DICT protocol, RFC 2229): a name.index file and the definitions
    in name.dict or name.dict.dz. FreeDict, GCIDE (the GNU Collaborative International Dictionary
    of English), WordNet, the Jargon File and many Linux dict-* packages ship this way.
  • StarDict: name.ifo, name.idx (or .idx.gz), name.dict.dz (or .dict) and an optional
    name.syn of alternate spellings, versions 2.4.2 and 3.0.0 (including 64-bit offsets).

FreeDict alone publishes about 300 bilingual dictionaries in both formats.
Useful for translating, checking a word or a spelling, or answering from a dictionary you trust
instead of a web search, also when the agent has no network.

This plugin is not affiliated with the DICT Development Group, StarDict, FreeDict or GNU. It reads
the files with Python's standard library only.

Tools

ToolWhat it does
dict_listLists the configured dictionaries: id, format, name, number of distinct headwords and of entries (definitions) and, when the dictionary gives them, its URL, author and a short description.
dict_defineReturns every definition of a word in one dictionary or all of them, as plain text. Matching ignores case. When no headword matches exactly, headwords that differ only in accents, punctuation or spaces are returned and marked "match": "loose". When nothing matches, suggestions lists headwords one typing slip away or starting with the word. Long results come back in parts (next_offset).
dict_matchFinds headwords without reading definitions, like the DICT protocol's MATCH: prefix (default), exact, substring, suffix, word (every word of the query is a whole word of the headword) and lev (one letter added, removed or changed, or two neighbouring letters swapped).

The tools are offered to the model only while at least one path is configured.

How a headword is compared follows each dictionary's own rules. In StarDict and in a dictd
dictionary marked 00-database-allchars, every character counts (c++ is not c). In other dictd
dictionaries only letters, digits and spaces count, as dictd itself compares them: FreeDict
indexes aaron's rod as aarons rod, and the query aaron's rod finds it as an exact match.

Definitions are returned as text. StarDict's HTML, Pango, XDXF and KingSoft markup is reduced to
plain text with list numbers and nesting kept; plain-text fields, phonetics (shown as /.../) and
WordNet text are returned as written. Sound, pictures and resource files are not returned; their
place is marked, for example [sound not shown].

Install

hermes plugins install offline-dict --enable

No dependencies: the plugin uses only the Python standard library (gzip, zlib, struct,
html.parser, unicodedata).

Get some dictionaries

On Debian and Ubuntu, dictd packages install their files under /usr/share/dictd:

sudo apt install dict-gcide dict-wn dict-freedict-eng-tur

FreeDict also offers each dictionary as a download in both formats, listed in
freedict-database.json:

mkdir -p ~/dictionaries && cd ~/dictionaries
curl -LO https://download.freedict.org/dictionaries/eng-tur/0.3/freedict-eng-tur-0.3.dictd.tar.xz
tar -xJf freedict-eng-tur-0.3.dictd.tar.xz      # creates eng-tur/ with eng-tur.index and eng-tur.dict.dz

StarDict dictionaries you already have (for example under ~/.stardict/dic or GoldenDict's
folders) work as they are. The dictionaries' own licenses apply to their content; FreeDict's are
listed in each archive's COPYING file.

Configure

plugins:
  entries:
    offline-dict:
      settings:
        paths:                 # dictionary files and/or folders holding them
          - /usr/share/dictd
          - ~/dictionaries
        max_chars: 12000       # optional; characters per dict_define call (1000-100000)

A path can be a dictionary's .index or .ifo file or any other part of it (such as
eng-tur.dict.dz), or a folder, which is scanned together with its direct subfolders (StarDict
keeps one dictionary per folder). Each dictionary's id is its file name without the suffix, for
example eng-tur. If two dictionaries share a name, the first one wins and the second is reported
under problems. Missing paths, missing parts and unreadable dictionaries are reported the same way
and do not hide the others.

What it does on your machine (disclosure)

  • Reads only the dictionaries you configure. For each one it opens its own files: .index and
    .dict(.dz) for dictd, .ifo, .idx(.gz), .dict(.dz) and .syn(.dz) for StarDict. Folders are
    listed only to find .index and .ifo files.
  • No network. Lookups are local. The test suite checks this by refusing to open any socket
    while all three tools run.
  • Writes nothing. Files are opened for each call and closed again; nothing is kept between
    calls. The tests check that every file is closed and that no file in the dictionary folders
    changes.
  • No credentials, no shell commands, no background work.
  • Bounded reading. An index larger than 256 MB (after unpacking) and a single definition larger
    than 4 MB are refused rather than loaded. One dict_define call reads at most 200 definitions.
  • Content is third-party text. Definitions are returned to the model as the dictionary's authors
    wrote them. Markup is reduced to plain text, but the words are not filtered. Use dictionaries from
    sources you trust.

Limits

  • Every call reads the index files again (nothing is cached), so a lookup takes time in proportion
    to the size of the dictionaries it looks in. Measured on an Apple M4 with Python 3.14: about
    0.7 s in FreeDict's German-English dictionary alone (517,534 entries), and about 1.4 s across five
    dictionaries (FreeDict English-Turkish, French-English and German-English, GCIDE, WordNet), 1.9 s
    when nothing matches and suggestions are collected. Pass dictionary to look in one only.
  • A .dict.dz written by plain gzip instead of dictzip (no chunk table) still works, but each
    definition is read by unpacking the file from the start, which is slow for large dictionaries.
  • Text only: sound and pictures in StarDict dictionaries are not returned.
  • Regular-expression and Soundex matching (two of dictd's optional MATCH strategies) are not offered.
  • A dictd index line with an empty headword cannot be looked up and is skipped. FreeDict's
    German-English dictd index has six: symbols such as $ and §, whose only characters the index
    dropped. dictd itself cannot reach them either; the StarDict edition of the same dictionary can.

Tested with

The plugin was run against these real dictionaries:

DictionaryFormatEntriesHeadwords
FreeDict English-Turkish 0.3dictd / StarDict36,589 / 36,58934,330 / 34,405
FreeDict French-English 0.4.1dictd / StarDict8,505 / 8,5058,249 / 8,417
FreeDict German-English 1.9-fd1dictd / StarDict517,533 / 517,534382,832 / 385,444
GCIDE 0.54 (Debian dict-gcide)dictd126,277177,010
WordNet 3.0 (Debian dict-wn)dictd147,306147,306

The dictd and StarDict editions of each FreeDict dictionary give the same number of entries
(German-English: one fewer in dictd, the one only reachable through an empty headword, see Limits). Their headword counts
differ because the dictd indexes drop punctuation (aaron's rod is aarons rod). In each of the
six FreeDict files, 300 randomly chosen headwords are each found as an exact match with non-empty
text; in all eight files, so are the first 25 headwords starting with "a" (the real_world test).

Development

python -m pip install pytest
python -m pytest -c tests/pytest.ini tests
OFFLINE_DICT_REAL=/usr/share/dictd:~/dictionaries python -m pytest -c tests/pytest.ini tests -k real_world
hermes plugins validate .

The tests write dictionaries in the real layouts: dictd indexes with dictd's base-64 offsets, in
UTF-8 and Latin-1, with a fourth "original headword" column and special 00-database-* entries in
both spellings converters use; definitions as plain .dict, as dictzip (a gzip file with an RA
chunk table, the deflate stream fully flushed after each chunk as dictzip writes it) and as plain
gzip; and StarDict sets in versions 2.4.2 and 3.0.0 with and without sametypesequence, a gzipped
index, 64-bit offsets and a .syn file. Broken dictionaries are there too: an index pointing past
the end of its data, a text file that is not an index, a wrong StarDict header or version, missing
parts and an oversized definition.

OFFLINE_DICT_REAL (one or more paths, separated like PATH) adds a test against real
dictionaries: for each one it takes up to 25 headwords starting with "a" and checks that each is
found as an exact match with non-empty text.

License

MIT

README from the reviewed commit 3f301ca; it updates when the author re-pins.

More by nftpoetrist

8 plugins by nftpoetrist in the catalog.

nftpoetristcalibre-libraryLets the agent search your calibre e-book libraries and read their EPUB and TXT books, from the metadata.db and book folders calibre leaves on disk; calibre need not be installed or running. calibre_search matches titles, authors, series, tags, publishers and identifiers (ISBN, ASIN, ...) ignoring case and accents, with author, series, tag, format and language filters; calibre_book shows everything calibre records about a book and its files; calibre_read returns an EPUB in reading order with chapter offsets, or a TXT decoded as UTF-8 or Windows-1252, in parts. Standard library only. Not affiliated with calibre. Disclosure — reads only the library folders you configure: metadata.db, opened read-only per call (mode=ro, or immutable=1 for a WAL-mode database, which is refused while its -wal holds changes), and the one book file asked for, which must lie inside the library folder. EPUBs are read in place, never extracted; a package declaring a DTD or entities, a document over 32 MB unpacked or a book over 128 MB is refused. Writes nothing, makes no network calls, needs no credentials and runs no commands. Book text and descriptions are returned to the model as they are, with scripts and styles stripped.Communitytools1nftpoetristoffline-docsetsLets the agent look up API documentation in docsets on this machine without internet access: the offline format Dash and Zeal use, with an index of every function, class and guide plus the HTML pages (Kapeli's public feeds list about 180, among them Python, Node.js, Bash, SQLite and Vim). docset_list lists the docsets configured under plugins.entries.offline-docsets.settings.paths, docset_search looks entries up by name in Dash's searchIndex or Apple's Core Data index, and docset_read returns a page as plain text starting at the entry's own section, in parts, with in-docset links listed. Standard library only. Not affiliated with Kapeli or Zeal. Disclosure — reads only the docsets you configure, and only pages inside each docset's Documents folder (paths through .., encoded .., absolute paths or symlinks that leave it are refused); opens the SQLite index with mode=ro&immutable=1 so nothing is written, a WAL-mode index's -wal and -shm files included; makes no network calls, needs no credentials and runs no commands. Page text is returned to the model as the documentation's authors wrote it, with scripts and styles stripped.Communitytoolsnftpoetristoffline-infoLets the agent search and read the GNU Info manuals on this machine without internet access: the full Texinfo documentation of coreutils, grep, sed, findutils, bash, make, gawk, Emacs, Elisp, Org and most other GNU software, as installed in /usr/share/info. info_list lists the manuals found under plugins.entries.offline-info.settings.paths, info_search looks up the manuals' own index entries and node names (like the info reader's index search; every word in the entry or its node, so 'sort -k' finds the -k entry of sort invocation) or the full text of nodes, and info_read returns a node as plain text with its up/next/prev nodes, menu and cross-references, from an index entry's line or an anchor, in parts. Reads single and split manuals, compressed with gzip, bzip2, xz or (Python 3.14) zstd, in the encoding each declares. Standard library only. Not affiliated with the GNU Project. Disclosure — reads only the Info files under the paths you configure and the subfiles their indirect tables name (a subfile name with a path separator or a leading dot is refused); folders are listed to find *.info files; writes nothing, keeps nothing between calls, makes no network calls, needs no credentials and runs no commands. Node text is returned as the manual's authors wrote it.Communitytoolsnftpoetristoffline-mailLets the agent search and read mail archives on this machine without signing in to any mail account: mbox files (Thunderbird's folders, a Google Takeout export of Gmail, mailing-list archives) and Maildir folders (mutt, mbsync, OfflineIMAP, Dovecot). mail_folders lists the folders found under plugins.entries.offline-mail.settings.paths, mail_search finds messages by the words of their subject, names, addresses or text (case and accents ignored) with folder, sender, recipient, date and Message-ID filters, newest first, and mail_read returns a message's headers, text (the plain-text part, or the HTML part as text) and attachment list, in parts. Standard library only. Disclosure — reads only the mail files under the paths you configure, and what the agent reads goes to your model provider like the rest of the conversation; opens files read-only and never sends, moves, deletes or marks mail (a Maildir message is not renamed to seen); makes no network calls, needs no credentials and runs no commands. Message text is returned as its senders wrote it, with HTML scripts and styles removed.Communitytools

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section