Documentation ¶
Overview ¶
Package versify implements an ion "versifier:" code that performs procedural data generation based on example input.
The Union value represents many ion values that have been superimposed in one structural position as part of training the output generation. Union.Add superimposes a new training value on the existing state, and Union.Generate draws from the existing distribution of superimposed values to generate a new value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Any ¶
type Any struct {
// contains filtered or unexported fields
}
Any is a generator that generates ion datums of different types based on their relative frequency of occurrence in the input corpus.
Note that a value being "missing" (returned as nil) is considered to be a distinct type in terms of drawing from the distribution of inputs.
type BlockGenerator ¶
type BlockGenerator struct { // Input is the input stream used to // generate the output data Input Union // Rand is the random source // passed to Input.Generate Rand *rand.Rand // Align is the alignment of uncompressed chunks Align int // Comp is the compression type // passed to blockfmt.Compression Comp string }
BlockGenerator generates blockfmt-formatted tables from a Union.
func (*BlockGenerator) Table ¶
func (b *BlockGenerator) Table(blocks int) ([]byte, error)
Table produces a compressed table containing at least the provided number of blocks and returns the encoded table as a []byte. Table will return an error if one of the generated output objects does not fit in b.Align.
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool is a Generator that generates only boolean values.
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float is a Generator that returns floating point values.
type Integer ¶
type Integer struct {
// contains filtered or unexported fields
}
Integer is a Generator that generates integer values.
Integer generates values that are uniformly distributed along the range of input values.
func FromUint64 ¶
FromUint64 returns an Integer that only generates u.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a Generator that returns list values.
func (*List) Generate ¶
Generate returns an ion.List that has a length drawn from the uniform distribution over the open interval of the lowest list length in the input corpus to the highest. The value at each position in the returned list is drawn from the distribution of input values at that position.
type None ¶
type None struct {
// contains filtered or unexported fields
}
None is the missing value.
type Null ¶
type Null struct {
// contains filtered or unexported fields
}
Null is the null value.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a Generator String value that returns a string value drawn from a set of input strings.
func FromString ¶
FromString returns a Generator that only returns the string s.
func (*String) Generate ¶
Generate returns a string drawn pseudorandomly from the distribution of input strings. Currently, every input string is equiprobable as an output datum.
NOTE: This should be fixed to generate strings based on the histogram of input values rather than just making each input string equiprobable!
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
Struct is Generator that represents a superposition of structures.
The Struct generator generates a set of struture fields based on the input corpus of structure fields by computing the union of all the structure fields it sees.
func FromStruct ¶
FromStruct returns a Struct Generator that only returns s.
func (*Struct) Generate ¶
Generate generates an ion.Struct by drawing from the set of observed fields in the test corpus.
The likelihood that any particular field is present is equal to the likelihood that the field was present in the input, and similarly the type of the structure field is determined by drawing from the distribution of input field types weighted by their relative likelihoods.
type Symbol ¶
type Symbol struct {
// contains filtered or unexported fields
}
Symbol is a collection of ion.Symbol
func FromSymbol ¶
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time is a Generator that generates timestamp datums.
type Union ¶
type Union interface { // Add returns a new Union that // superimposes the value on the receiver Add(value ion.Datum) Union // Generate generates a new value based // on the template implied by the superposition // of values. Generate(src *rand.Rand) ion.Datum // String describes the union String() string }
Union represents the superposition of multiple values.