estándraares para manmies

  Pubblico Statico Classe JarowinklerDistance {/ * La modifica Winkler non verrà applicata a meno che la corrispondenza * percentuale sia stata o superiore al mothereshold percento * senza la modifica. * La carta Winkler ha utilizzato un valore predefinito di 0,7 * / Privatic Statico LeadOnly Double Mothereshold = 0,7; / * Dimensione del prefisso da inicare dalla modifica Winkler. * La carta Winkler ha utilizzato un valore predefinito di 4 * / Privatic Static Readonly Int Mnumchars = 4; /// < Riepilogo > /// Restituisce la distanza di Jaro-Winkler tra le stringhe specificate ///. La distanza è simmetrica e cadrà nell'area /// range 0 (perfetta corrispondenza) a 1 (nessuna partita). /// < / Sommario > /// < NAME PARAM = "ASTRING1" > PRIMA STRING < / Param > /// < nome param = "astring2" > seconda stringa < / param > /// < restituisce > < / returns > Doppia distanza statica pubblica (stringa ASTRING1, String ASTRING2) {RETURN 1.0 - Prossimità (ASTRING1, ASTRING2); } /// < Riepilogo > /// Restituisce la distanza di Jaro-Winkler tra le stringhe specificate ///. La distanza è simmetrica e cadrà nell'intervallo /// range 0 (nessuna corrispondenza) a 1 (perfetta corrispondenza). /// < / Sommario > /// < NAME PARAM = "ASTRING1" > PRIMA STRING < / Param > /// < nome param = "astring2" > seconda stringa < / param > /// < restituisce > < / returns > Public Static Mable Proximity (stringa ASTRING1, stringa ASTRING2) {int Llen1 = ASTRING1.Lunghezza; int llen2 = astring2.length; IF (LLEN1 == 0) Restituisce Llen2 == 0? 1.0: 0.0; int lsearchrange = math.max (0, math.max (llen1, llen2) / 2 - 1); // predefinito inizializzato a false bool lmatched1 = nuovo bool; bool lmatched2 = nuovo bool; int lnumcommon = 0; per (int I = 0; I < LLEN1; ++ I) {int LStart = math.max (0, i-lsearchrange); int land = math.min (i + lsearchrange + 1, llen2); per (int j = lstart; j < prestando; ++ j) {if (lmatched2) Continua; Se (ASTRING1! = ASTRING2) continua; lmatched1 = true; lmatched2 = true; ++ lnumcommon; rompere; }} se (lnumcommon == 0) restituisce 0.0; int lnumhalftransposed = 0; int k = 0; per (int I = 0; I < LLEN1; ++ I) {IF (! LMATCHED1) Continua; while (! lmatched2) ++ k; IF (ASTRING1! = ASTRING2) ++ LNUMHALFRASONSED; ++ k; } // system.diagnostics.debug.writeline ("numhalftransposed =" + numhalftrisposed); int lnumtrasposed = lnumhalftrasposed / 2; // System.Diagnostics.debug.writelline ("Numcommon =" + Numcommon + "NumTransposed =" + NumTransposed); doppio lnumcommond = lnumcommon; Doppio peso = (lnumcommond / llen1 + lnumcommond / llen2 + (lnumcommon - lnumtrasposed) / lnumcommond) /3.0; se (peso < = MOWHTHRESHOLDSHOLD) TESSO DI RITORNO; int lmax = math.min (mnumchars, math.min (astring1.length, astring2.length)); int lpos = 0; while (LPOS < LMAX & & ASTRING1 == ASTRING2) ++ LPOS; IF (LPOS == 0) Return Lweight; Return Lweight + 0.1 * LPOS * (1,0 - peso); }}  

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *