Documentation
¶
Overview ¶
Package shoco is a compressor for small text strings based on the shoco C library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultModel = WordsEnModel
DefaultModel is the default model used by the package level functions.
var ErrInvalid = errors.New("shoco: invalid input")
ErrInvalid is returned by decompress functions when the compressed input data is malformed.
var FilePathModel = filePathModel
FilePathModel is a model optimised for filepaths.
Deprecated: Use models.FilePath() instead.
var TextEnModel = textEnModel
TextEnModel is a model optimised for English langauge text.
Deprecated: Use models.TextEn() instead.
var WordsEnModel = wordsEnModel
WordsEnModel is a model optimised for words of the English langauge.
Deprecated: Use models.WordsEn() instead.
Functions ¶
func Decompress ¶
Decompress uses DefaultModel to decompress the input data, it will return an error if the data is invalid.
func ProposedCompress ¶
ProposedCompress uses DefaultModel to compress the input data, it uses a shorter encoding for non-ASCII characters.
func ProposedDecompress ¶
ProposedDecompress uses DefaultModel to decompress the input data, it will return an error if the data is invalid. It requires the data to have been previously compressed with the shorter encoding produced by ProposedCompress.
Types ¶
type Model ¶
type Model struct { ChrsByChrID []byte ChrIdsByChr [256]int8 SuccessorIDsByChrIDAndChrID [][]int8 ChrsByChrAndSuccessorID [][]byte Packs []Pack MinChr byte MaxSuccessorN int // contains filtered or unexported fields }
Model represents a shoco compression model.
It can be generated using the generate_compressor_model.py script in Ed-von-Schleck/shoco. The output of that script will require conversion to Go code. The script is available at: https://github.com/Ed-von-Schleck/shoco/blob/4dee0fc850cdec2bdb911093fe0a6a56e3623b71/generate_compressor_model.py.
func (*Model) Decompress ¶
Decompress uses the given model to decompress the input data, it will return an error if the data is invalid.
func (*Model) ProposedCompress ¶
ProposedCompress uses the given model to compress the input data, it uses a shorter encoding for non-ASCII characters.
func (*Model) ProposedDecompress ¶
ProposedDecompress uses the given model to decompress the input data, it will return an error if the data is invalid. It requires the data to have been previously compressed with the shorter encoding produced by ProposedCompress.