| |
|
|
p.specht
| The Jaro-Algorithmus is a measured for joint characters, The within "nicht More as the half-way length the longer Zeichenkette" lying, under Berücksichtigung of Transpositionen (Verdrehungen). Winkler modified this Algorithmus, around the Faktum To respect, that differences at the beginning the Zeichenkette signifikanter are as differences end the Zeichenkette. Jaro and Jaro-Winkler suit itself for comparison kleinerer Zeichenketten How Wörter and names.
for further Stringähnlichkeitsvergleiche knows one whom Levenshtein-Algorithmus or The Kölner Phonetik. Levenshtein counts The Number of Bearbeitungen (Einfügungen, Löschungen or Substitutionen), The necessary are, circa a Zeichenkette into others To konvertieren. Damerau-Levenshtein is a modified Version, The Transpositionen too as Einzelbearbeitung viewing. though The spending The ganzzahlige Number of Bearbeitungen is, it can standardisiert go, circa a Ähnlichkeitswert by a Formel to obtain
in the practice is it important, a method To dial, The the manner the Zeichenketten corresponds to, everybody can vergleichen wants. some Verfahre are plenty aufwändiger as about The Berechnung of/ one phonetischen beforehand-Kodierung. from the speed since is the Order: 1. Jaro, 2. Jaro-Winkler, 3. Levenshtein, 4. Damerau-Levenshtein, where between schnellstem and langsamsten Algorithmus one factor 2 To 3 lying..
Window Title "Jaro-Winkler String-Ähnlichkeit"
'Q: https://rosettacode.org/wiki/Jaro_distance#Pascal
'Topic: https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance
'Dissertation [Christen 2006]: Systemvergleich Jaro - Levenshtein
'https://users.cecs.anu.edu.au/~Peter.Christen/publications/tr-cs-06-02.pdf
'(D) demonstration translation, 2018-10-28 by P.woodpecker, Vienna/EU
'without each Gewähr! No warranty whatsoever!
CLS:font 2
print stature$("0.#######", JaroWinkler("DWAYNE","DUANE"))
print stature$("0.#######", JaroWinkler("MARTHA","MARHTA"))
print stature$("0.#######", JaroWinkler("DIXON","DICKSONX"))
print stature$("0.#######", JaroWinkler("JELLYFISH","SMELLYFISH"))
' Solloutput:
' 0.822222
' 0.944444
' 0.766667
' 0.896296
waitinput
END
Proc JaroWinkler :parameters s1$,s2$
declare l1&,l2&,match_distance&,matches&,i&,k&,trans&,gr&,kl&
declare bs1&[255],bs2&[255]'max string length is hier 255
l1&=len(s1$):l2&=len(s2$)
ifnot l1&:ifnot l2&:return 1:else:return 0:endif:endif
match_distance&= if(l1&>l2&,l1&,l2&)\2-1
' matches&=0
' trans&=0
Whileloop l1&:i&=&Loop
gr&=i&-match_distance&
kl&=i&+match_distance&
whileloop if(1>gr&,1,gr&),if(kl&<l2&,kl&,l2&):k&=&Loop
case bs2&[k&]:continue
case mid$(s1$,i&,1)<>mid$(s2$,k&,1):continue
bs1&[i&]=1:bs2&[k&]=1'1=true
inc matches&:break
endwhile
endwhile
casenot matches&:return 0
k&=1
whileloop l1&:i&=&Loop
casenot bs1&[i&]:continue
:whilenot bs2&[k&]:inc k&:endwhile
case mid$(s1$,i&,1)<>mid$(s2$,k&,1):inc trans&
inc k&
endwhile
trans&=trans&\2
return ((matches&/l1&)+(matches&/l2&)+((matches&-trans&)/matches&))/3
endproc
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/29/21 ▲ |
|
|
|