core

package module
v0.0.0-...-6995082 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: GPL-3.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileDictionary

func CompileDictionary(xmlPath string, outputPath string) (int, error)

CompileDictionary compiles an XML file into an ODict binary

func GetDictionaryBytesFromXML

func GetDictionaryBytesFromXML(xmlStr string) ([]byte, error)

func GetDictionaryFromXML

func GetDictionaryFromXML(xmlStr string) *types.DictionaryRepresentable

func Lexicon

func Lexicon(dict *types.Dictionary) []string

Lexicon returns all originally-cased entries of a compiled dictionary

func Lookup

func Lookup(request LookupRequest) [][]types.Entry

func MergeDictionaries

func MergeDictionaries(dst *types.Dictionary, srcs ...*types.Dictionary) (*types.DictionaryRepresentable, error)

MergeDictionaries merges the entries of two dictionaries.

func ReadDictionary

func ReadDictionary(pathOrAlias string) (*types.Dictionary, error)

ReadDictionary loads a compiled ODict dictionary from the provided path and returns a Dictionary model, with the ability to forcibly re-index the dictionary when it loads

func ReadDictionaryFromBytes

func ReadDictionaryFromBytes(bytes []byte) (*types.Dictionary, error)

ReadDictionaryFromBytes loads a compiled ODict dictionary from the provided bytes and returns a Dictionary model, with the ability to forcibly re-index the dictionary when it loads

func ReadDictionaryFromPath

func ReadDictionaryFromPath(path string) (*types.Dictionary, error)

ReadDictionaryFromPath loads a compiled ODict dictionary from the provided path and returns a Dictionary model, with the ability to forcibly re-index the dictionary when it loads

func Split

func Split(request SplitRequest) []types.Entry

Split splits a query into definable tokens greater than or equal to the specified threshold Example: household -> house + hold

func WriteDictionaryFromXML

func WriteDictionaryFromXML(xmlStr, outputPath string) (int, error)

WriteDictionary generates an ODict binary file given a ODXML input file path

func WriteDictionaryToDisk

func WriteDictionaryToDisk(outputPath string, dictionary *types.DictionaryRepresentable) (int, error)

Types

type LookupRequest

type LookupRequest struct {
	Dictionary *types.Dictionary
	Queries    []string
	Follow     bool
	Split      int
}

type ODictFile

type ODictFile struct {
	Signature string
	Version   uint16
	Content   []byte
}

type SplitRequest

type SplitRequest struct {
	Dictionary *types.Dictionary
	Query      string
	Threshold  int
}

Jump to

Keyboard shortcuts

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