Sha256: 30c0011afd69aa7dd268d082bee238c2670b725500f80f7af7272280112947ce
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require 'jaro_winkler' describe JaroWinkler do it 'works' do expect(JaroWinkler.jaro_winkler_distance("MARTHA", "MARHTA")).to be_within(0.0001).of(0.9611) expect(JaroWinkler.jaro_winkler_distance("DIXON", "DICKSONX")).to be_within(0.0001).of(0.8133) expect(JaroWinkler.jaro_winkler_distance("abcvwxyz", "cabvwxyz")).to be_within(0.0001).of(0.9583) expect(JaroWinkler.jaro_winkler_distance("DWAYNE", "DUANE")).to eq 0.84 expect(JaroWinkler.jaro_winkler_distance("tony", "tony")).to eq 1.0 expect(JaroWinkler.jaro_winkler_distance("tonytonyjan", "tonytonyjan")).to eq 1.0 expect(JaroWinkler.jaro_winkler_distance("", "")).to eq 0.0 expect(JaroWinkler.jaro_winkler_distance("tony", "")).to eq 0.0 expect(JaroWinkler.jaro_winkler_distance("", "tony")).to eq 0.0 end it 'can ignore case' do expect(JaroWinkler.jaro_winkler_distance("MARTHA", "marhta", case_match: true)).to be_within(0.0001).of(0.9611) end it 'can set weight' do expect(JaroWinkler.jaro_winkler_distance("MARTHA", "MARHTA", weight: 0.2)).to be_within(0.0001).of(0.9778) expect{ JaroWinkler.jaro_winkler_distance("MARTHA", "MARHTA", weight: 0.26) }.to raise_error end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jaro_winkler-1.0.1 | spec/jaro_winkler_spec.rb |
jaro_winkler-1.0.0 | spec/jaro_winkler_spec.rb |