dict

package
v0.0.0-...-fad336a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(path string) error

Build builds all dictionaries into subdirectories of the provided path, which should be empty.

func BuildDict

func BuildDict(path string, dict []Entry) error

BuildDict builds a single dictionary into the provided path.

func Dicts

func Dicts() []string

Dicts gets the registered dictionary names.

func JS

func JS() []byte

JS gets the javascript for reading the parsed dictionaries.

func Normalize

func Normalize(term string) string

Normalize reduces term to a limited set of ASCII characters.

func Parse

func Parse(verbose bool) error

Parse parses dictionaries.

func Register

func Register(name string, parse ParseFunc)

Register adds a dictionary to be parsed when Parse is called.

Types

type Entry

type Entry struct {
	Terms         []string       // matched terms (will be normalized)
	Name          string         //
	Pronunciation string         // optional
	MeaningGroups []EntryMeaning //
	Info          string         // optional; e.g., etymology
	Source        string         // optional
}

Entry contains a single result.

Name • Pronunciation
...
Info
Source

type EntryMeaning

type EntryMeaning struct {
	Info         []string           // optional
	Meanings     []EntryMeaningItem //
	WordVariants []string           // for sorting results by relevance; not used for matching or display, so it can be imperfect (note that the headword is also checked first)
}

EntryMeaning contains the definitions for one sub-form of a word.

Info[0] — Info[*] <-- like parts of speech, word forms, etc

  1. [Meanings[0].Tags[0]] [Meanings[0].Tags[*]] Meanings[0].Text Meanings[0].Example <-- can be disabled
  2. Meanings[*]

type EntryMeaningItem

type EntryMeaningItem struct {
	Tags     []string // optional
	Text     string   //
	Examples []string // optional
}

EntryMeaningItem contains a single definition.

type ParseFunc

type ParseFunc func() ([]Entry, error)

ParseFunc parses a dictionary.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL