![]() Jw = jarowink('JERALDINE', 'GERALDINE', 0. Jw = jarowink('NICHLESON', 'NICHULSON', 0.1) Jw = jarowink('DUNNINGHAM', 'CUNNIGHAM', 0.1) Jw = jarowink('SHACKLEFORD', 'SHACKELFORD', 0.1) *** tell SAS where to find the functions we just wrote *** Return(jarodist + prelen * prefixscale * (1 - jarodist)) Prelen = getPrefixlen(string1, string2, 4) Proving Triangle Similarity by SSS and SAS - a Lets consider the following diagram. *** check for trivial case and calc JW if needed *** *** get number of transposed characters *** įunction jarowink(string1 $, string2 $, prefixscale) *** get number of matched characters in string2 *** *** get number of matched characters in string1 *** Return(n) *** all maxprelen characters match *** If substr(string1, i, 1) ne substr(string2, i, 1) N = min(maxprelen, lengthn(string1), lengthn(string2)) If substr(string1, i, 1) ne substr(string2, i, 1) then ntrans + 1 įunction getPrefixlen(string1 $, string2 $, maxprelen) * count the number of "half" transpositions */įunction jarotrans(string1 $, string2 $) ĭo i = 1 to min(lengthn(strip(string1)), lengthn(strip(string2))) Substr(string2, allowed_start + position -1, 1) = '~' *** Once a char is assigned, it can not be assigned again. SAS Similarity Theorem: If in two triangles, one pair of corresponding sides are proportional and the included angles are equal then the two triangles are. MatchChars = cats(matchChars, substr(allowed_str2, position, 1)) Position = findc(allowed_str2, substr(string1, i, 1)) *** find i char from string1 in string2 within the allowedDist *** *** get the part of string2 to search *** Īllowed_start = max(1, i - allowedDist) *** starting char position *** Īllowed_str2 = substr(string2, allowed_start, i + allowedDist - allowed_start + 1) *** walk through string1 and match characters to string2 *** Two chars from string1 and string2Īre considered matching if they are no farther apart thanįunction jaromatch(string1 $, string2 $) $ 40 ĪllowedDist = floor(max(str1_len, str2_len) / 2) - 1 * Returns matched characters between 2 strings. (See table 6) I used the examples to test my code. * tell SAS where to find the functions we just wrote */ Prelen=getPrefixlen(string1, string2, 4) Įlse return(jarodist + prelen * prefixscale * (1-jarodist)) * get number of transposed characters */įunction jarowink( string1 $, string2 $, prefixscale) ![]() If substr(string1,i,1) ne substr(string2,i,1) N = min(maxprelen, length(string1), length(string2)) * get the length of the matching characters at the beginning */ If substr(string1,i,1) ne substr(string2,i,1) then do įunction getPrefixlen( string1 $, string2 $, maxprelen) Since all the ratios are the same, A B C E F D by the SSS Similarity Theorem. Start with the longest sides and work down to the shortest sides. ![]() Ubnd = min(length(strip(string1)), length(strip(string2))) We will need to find the ratios for the corresponding sides of the triangles and see if they are all the same. Position = findc(string2,x ,max(1,i-allowedDist)) įunction jarotrans (string1 $, string2 $ ) * walk through string 1 and match characters to string2 */ If they are no farther than floor(max(|s1|, |s2|)/2)-1 */ĪllowedDist = floor(max(str1_len, str2_len)/2) -1 * two chars from string1 and string2 are considered matching * Returns number of matched characters between 2 strings excluding blanks*/ Subroutine jaromatch ( string1 $, string2 $, matchChars $) It certainly isn't close to being a perfect representation of Bill Winkler's strcmp.c file by any means and likely has lots of bugs. I just tried to follow the wikipedia article on it. ![]() I'll even give you a head start with the code below. ![]() You can roll you own functions with proc fcmp though if you feel up to it. already reference the only ones that I know of. To prove that the triangles are similar by the SAS similarity theorem, it needs to be proven that two sides and included angles in both are congruent.There is no built in function for jaro-winkler distance that I am aware of. Thus, QN = YZ by SAS congruence criterion. Now △MQN and △XYZ are congruent thus, XY/QP = YZ/QR - (2) SAS Similarity theorem states that, “If two sides in one triangle are proportional to two sides in another triangle and the included angle in both are congruent, then the two triangles are similar”.ĭraw MN parallel to BC, we find that MQN similar to XYZ To prove that the triangles are similar by the SAS similarity theorem, it needs to be proven that two sides and included angles in both are congruent? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |