Documentation
¶
Index ¶
- func Normalize(s []string, punctuations string, alphabet []string) []string
- type Compact
- type Moves
- type Splices
- func (s *Splices) EncodeCompact(offset int, before, after string) string
- func (s *Splices) ForEach(fn func(string))
- func (s *Splices) ForEachPair(fn func(left, right string))
- func (s *Splices) ForEachUniquePair(alphabet []string, fn func(string, string, string))
- func (s *Splices) ForEachUniqueSpliceMovePair(alpha []string, fn func(string, string, string))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Normalize ¶
Normalize takes a bunch of strings and uses a normalization procedure to return a new set of strings.
Normalization works by identifying substrings that only ever appear together in all the provided input strings. (Punctuations are considered as effectively breaking strings). It then assigns a unique letter for each prefix -- the letter is assigned in order in which the prefix appears (those in earlier strings are considered earlier prefixes and those in latter strings are considerd latter; and within a string, an earlier prefix gets an earlier alphabet)
This process indirectly helps with identifying if two sequences of strings are "isomorphic" by comparing if their normalized forms are the same.
Note that this process is quite fragile. For example, it is not legal to have a string that has any characters duplicated. If that happens, the behavior is random.
Types ¶
type Compact ¶
type Compact struct{}
Compact implements some helper routines for working with the compact form as defined in CompactJSON.md
func (Compact) Encode ¶
Encode takes an input and a set of changes and converts it into the compact form
type Moves ¶
type Moves struct {
Input string
}
Moves implements a bunch of useful utiities for working with moves
func (*Moves) EncodeCompact ¶
EncodeCompact encodes a move into a compact format
func (*Moves) ForEach ¶
ForEach generates all possible move operations for the given input string and calls the provided callback with the op encoded as in this spec: http://github.com/dotchain/dataset/CompactJSON.md
func (*Moves) ForEachPair ¶
ForEachPair generates pairs of operations
type Splices ¶
Splices implements a bunch of useful utiities for working with splices
func (*Splices) EncodeCompact ¶
EncodeCompact encodes a splice into a compact format
func (*Splices) ForEach ¶
ForEach generates all possible splice operations for the given input string and calls the provided callback with the splice encoded as in this spec: http://github.com/dotchain/dataset/CompactJSON.md
func (*Splices) ForEachPair ¶
ForEachPair generates pairs of operations
func (*Splices) ForEachUniquePair ¶
ForEachUniquePair generates only unique pairs of operations and uses the provided alphabet for the "uniqueness" calculation