Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MatchMismatch ¶
type MatchMismatch struct { // Match represents the score of equal character substitutions. Match float64 // Mismatch represents the score of unequal character substitutions. Mismatch float64 }
MatchMismatch represents a substitution function which returns the match or mismatch value depeding on the equality of the compared characters. The match value must be greater than the mismatch value.
type SmithWatermanGotoh ¶
type SmithWatermanGotoh struct { // CaseSensitive specifies if the string comparison is case sensitive. CaseSensitive bool // GapPenalty defines a score penalty for character insertions or deletions. // For relevant results, the gap penalty should be a non-positive number. GapPenalty float64 // Substitution represents a substitution function which is used to // calculate a score for character substitutions. Substitution Substitution }
SmithWatermanGotoh represents the Smith-Waterman-Gotoh metric for measuring the similarity between sequences.
For more information see https://en.wikipedia.org/wiki/Smith-Waterman_algorithm.
func NewSmithWatermanGotoh ¶
func NewSmithWatermanGotoh() *SmithWatermanGotoh
NewSmithWatermanGotoh returns a new Smith-Waterman-Gotoh string metric.
Default options:
CaseSensitive: true GapPenalty: -0.5 Substitution: MatchMismatch{ Match: 1, Mismatch: -2, },
func (*SmithWatermanGotoh) Compare ¶
func (m *SmithWatermanGotoh) Compare(a, b string) float64
Compare returns the Smith-Waterman-Gotoh similarity of a and b. The returned similarity is a number between 0 and 1. Larger similarity numbers indicate closer matches.
type Substitution ¶
type Substitution interface { // Compare returns the substitution score of characters a[idxA] and b[idxB]. Compare(a []rune, idxA int, b []rune, idxB int) float64 // Returns the maximum score of a character substitution operation. Max() float64 // Returns the minimum score of a character substitution operation. Min() float64 }
Substitution represents a substitution function which is used to calculate a score for character substitutions.