Skip to content

ianlewis/go-stardict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5b72c50 · Feb 25, 2025

History

86 Commits
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Nov 1, 2024
Nov 1, 2024
Feb 5, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
May 28, 2021
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Nov 1, 2024
Nov 1, 2024
Nov 4, 2024
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025

go-stardict

Go Reference codecov Tests Go Report Card

A stardict dictionary library for Go.

Status

The API is currently unstable and will change. This package will use module version numbering to manage versions and compatibility.

Features

  • Reading dictionary metadata (.ifo files).
  • Reading & searching the dictionary index (.idx file).
  • Reading full dictionary articles.
  • Efficient access for large files.
  • Dictzip support.
  • Capitalization, diacritic, punctuation, and whitespace folding (#19, #25).
  • Synonym support (.syn file) (#2).
  • Support for tree dictionaries (.tdx file) (#3).
  • Support for Resource Storage (res/ directory) (#4).
  • Support for collation files (.idx.clt, .syn.clt) (#7)
  • Support for offset cache files (.idx.oft, .syn.oft) (#8)
  • Glob/Wildcard search support (#21).

Installation

To install this package run

go get github.com/ianlewis/go-stardict

Examples

Searching a Dictionary

You can search a stardict dictionary directly and list the entries.

// Open dictonaries in a directory
dictionaries, _ := stardict.OpenAll(".")

// Search the dictionaries.
for _, d := range dictionaries {
  entries, _ := d.Search("banana")
  for _, e := range entries {
    // Print out matching index entries.
    fmt.Println(e)
  }
}

Related projects

References