public class NeedlemanWunch extends Object implements StringMetric
Implementation uses linear space.
This class is immutable and thread-safe if its substitution function is.
Constructor and Description |
---|
NeedlemanWunch()
Constructs a new Needleman-Wunch metric.
|
NeedlemanWunch(float gapValue,
Substitution substitution)
Constructs a new Needleman-Wunch metric.
|
Modifier and Type | Method and Description |
---|---|
float |
compare(String a,
String b)
Measures the similarity between strings a and b.
|
String |
toString() |
public NeedlemanWunch()
-2.0
a -1.0
substitution penalty for mismatches, 0
for matches.public NeedlemanWunch(float gapValue, Substitution substitution)
gapValue
- a non-positive penalty for gapssubstitution
- a substitution function for mismatched characterspublic float compare(String a, String b)
StringMetric
compare
in interface Metric<String>
compare
in interface StringMetric
a
- string a to compareb
- string b to compareCopyright © 2014–2018. All rights reserved.