...

Source file src/github.com/xrash/smetrics/tests/testcases.go

Documentation: github.com/xrash/smetrics/tests

     1  package tests
     2  
     3  type levenshteincase struct {
     4  	s     string
     5  	t     string
     6  	icost int
     7  	dcost int
     8  	scost int
     9  	r     int
    10  }
    11  
    12  type soundexcase struct {
    13  	s string
    14  	t string
    15  }
    16  
    17  type hammingcase struct {
    18  	a    string
    19  	b    string
    20  	diff int
    21  }
    22  
    23  type jarocase struct {
    24  	a string
    25  	b string
    26  	r float64
    27  }
    28  
    29  var __jaro_cases = []*jarocase{
    30  	{a: "SHACKLEFORD", b: "SHACKELFORD", r: 0.970},
    31  	{a: "DUNNINGHAM", b: "CUNNIGHAM", r: 0.896},
    32  	{a: "NICHLESON", b: "NICHULSON", r: 0.926},
    33  	{a: "JONES", b: "JOHNSON", r: 0.790},
    34  	{a: "MASSEY", b: "MASSIE", r: 0.889},
    35  	{a: "ABROMS", b: "ABRAMS", r: 0.889},
    36  	{a: "HARDIN", b: "MARTINEZ", r: 0.722},
    37  	{a: "ITMAN", b: "SMITH", r: 0.467},
    38  	{a: "JERALDINE", b: "GERALDINE", r: 0.926},
    39  	{a: "MARHTA", b: "MARTHA", r: 0.944},
    40  	{a: "MICHELLE", b: "MICHAEL", r: 0.869},
    41  	{a: "JULIES", b: "JULIUS", r: 0.889},
    42  	{a: "TANYA", b: "TONYA", r: 0.867},
    43  	{a: "DWAYNE", b: "DUANE", r: 0.822},
    44  	{a: "SEAN", b: "SUSAN", r: 0.783},
    45  	{a: "JON", b: "JOHN", r: 0.917},
    46  	//	{a: "JON", b: "JAN", r: 0.000},
    47  	{a: "BROOKHAVEN", b: "BRROKHAVEN", r: 0.933},
    48  	{a: "BROOK HALLOW", b: "BROOK HLLW", r: 0.944},
    49  	{a: "DECATUR", b: "DECATIR", r: 0.905},
    50  	{a: "FITZRUREITER", b: "FITZENREITER", r: 0.856},
    51  	{a: "HIGBEE", b: "HIGHEE", r: 0.889},
    52  	{a: "HIGBEE", b: "HIGVEE", r: 0.889},
    53  	{a: "LACURA", b: "LOCURA", r: 0.889},
    54  	{a: "IOWA", b: "IONA", r: 0.833},
    55  	//	{a: "1ST", b: "IST", r: 0.000},
    56  
    57  	// Equal strings.
    58  	{a: "", b: "", r: 1.000},
    59  	{a: "A", b: "A", r: 1.000},
    60  	{a: "AA", b: "AA", r: 1.000},
    61  	{a: "AAA", b: "AAA", r: 1.000},
    62  	{a: "AAAA", b: "AAAA", r: 1.000},
    63  	{a: "AAAAA", b: "AAAAA", r: 1.000},
    64  	{a: "AAAAAA", b: "AAAAAA", r: 1.000},
    65  	{
    66  		a: "Legend of the Galactic Heroes",
    67  		b: "Legend of the Galactic Heroes",
    68  		r: 1.000,
    69  	},
    70  	{
    71  		a: "Home is the place where, when you have to go there, they have to take you in.",
    72  		b: "Home is the place where, when you have to go there, they have to take you in.",
    73  		r: 1.000,
    74  	},
    75  	{
    76  		a: "Pedro de Alcântara João Carlos Leopoldo Salvador Bibiano Francisco Xavier de Paula Leocádio Miguel Gabriel Rafael Gonzaga de Habsburgo-Lorena e Bragança",
    77  		b: "Pedro de Alcântara João Carlos Leopoldo Salvador Bibiano Francisco Xavier de Paula Leocádio Miguel Gabriel Rafael Gonzaga de Habsburgo-Lorena e Bragança",
    78  		r: 1.000,
    79  	},
    80  	{
    81  		a: "Et tu, Brute",
    82  		b: "Et tu, Brute",
    83  		r: 1.000,
    84  	},
    85  
    86  	// Completely different strings.
    87  	{a: "", b: "A", r: 0.000},
    88  	{a: "", b: "AA", r: 0.000},
    89  	{a: "", b: "AAA", r: 0.000},
    90  	{a: "", b: "AAAA", r: 0.000},
    91  	{a: "", b: "AAAAA", r: 0.000},
    92  	{a: "A", b: "", r: 0.000},
    93  	{a: "AA", b: "", r: 0.000},
    94  	{a: "AAA", b: "", r: 0.000},
    95  	{a: "AAAA", b: "", r: 0.000},
    96  	{a: "AAAAA", b: "", r: 0.000},
    97  	{a: "A", b: "B", r: 0.000},
    98  	{a: "AA", b: "BB", r: 0.000},
    99  	{a: "AAA", b: "BBB", r: 0.000},
   100  	{a: "AAAA", b: "BBBB", r: 0.000},
   101  	{a: "AAAAa", b: "BBBBB", r: 0.000},
   102  }
   103  
   104  var __jaro_winkler_cases = []*jarocase{
   105  	{a: "SHACKLEFORD", b: "SHACKELFORD", r: 0.982},
   106  	{a: "DUNNINGHAM", b: "CUNNIGHAM", r: 0.896},
   107  	{a: "NICHLESON", b: "NICHULSON", r: 0.956},
   108  	{a: "JONES", b: "JOHNSON", r: 0.832},
   109  	{a: "MASSEY", b: "MASSIE", r: 0.933},
   110  	{a: "ABROMS", b: "ABRAMS", r: 0.922},
   111  	{a: "HARDIN", b: "MARTINEZ", r: 0.722},
   112  	{a: "ITMAN", b: "SMITH", r: 0.467},
   113  	{a: "JERALDINE", b: "GERALDINE", r: 0.926},
   114  	{a: "MARHTA", b: "MARTHA", r: 0.961},
   115  	{a: "MICHELLE", b: "MICHAEL", r: 0.921},
   116  	{a: "JULIES", b: "JULIUS", r: 0.933},
   117  	{a: "TANYA", b: "TONYA", r: 0.880},
   118  	{a: "DWAYNE", b: "DUANE", r: 0.840},
   119  	{a: "SEAN", b: "SUSAN", r: 0.805},
   120  	{a: "JON", b: "JOHN", r: 0.933},
   121  	//	{a: "JON", b: "JAN", r: 0.000},
   122  	{a: "BROOKHAVEN", b: "BRROKHAVEN", r: 0.947},
   123  	{a: "BROOK HALLOW", b: "BROOK HLLW", r: 0.967},
   124  	{a: "DECATUR", b: "DECATIR", r: 0.943},
   125  	{a: "FITZRUREITER", b: "FITZENREITER", r: 0.913},
   126  	{a: "HIGBEE", b: "HIGHEE", r: 0.922},
   127  	{a: "HIGBEE", b: "HIGVEE", r: 0.922},
   128  	{a: "LACURA", b: "LOCURA", r: 0.900},
   129  	{a: "IOWA", b: "IONA", r: 0.867},
   130  	//	{a: "1ST", b: "IST", r: 0.000},
   131  	{a: "w", b: "w", r: 1.000},
   132  
   133  	// Equal strings.
   134  	{a: "", b: "", r: 1.000},
   135  	{a: "A", b: "A", r: 1.000},
   136  	{a: "AA", b: "AA", r: 1.000},
   137  	{a: "AAA", b: "AAA", r: 1.000},
   138  	{a: "AAAA", b: "AAAA", r: 1.000},
   139  	{a: "AAAAA", b: "AAAAA", r: 1.000},
   140  	{a: "AAAAAA", b: "AAAAAA", r: 1.000},
   141  	{
   142  		a: "Legend of the Galactic Heroes",
   143  		b: "Legend of the Galactic Heroes",
   144  		r: 1.000,
   145  	},
   146  	{
   147  		a: "Home is the place where, when you have to go there, they have to take you in.",
   148  		b: "Home is the place where, when you have to go there, they have to take you in.",
   149  		r: 1.000,
   150  	},
   151  	{
   152  		a: "Pedro de Alcântara João Carlos Leopoldo Salvador Bibiano Francisco Xavier de Paula Leocádio Miguel Gabriel Rafael Gonzaga de Habsburgo-Lorena e Bragança",
   153  		b: "Pedro de Alcântara João Carlos Leopoldo Salvador Bibiano Francisco Xavier de Paula Leocádio Miguel Gabriel Rafael Gonzaga de Habsburgo-Lorena e Bragança",
   154  		r: 1.000,
   155  	},
   156  	{
   157  		a: "Et tu, Brute",
   158  		b: "Et tu, Brute",
   159  		r: 1.000,
   160  	},
   161  
   162  	// Completely different strings.
   163  	{a: "", b: "A", r: 0.000},
   164  	{a: "", b: "AA", r: 0.000},
   165  	{a: "", b: "AAA", r: 0.000},
   166  	{a: "", b: "AAAA", r: 0.000},
   167  	{a: "", b: "AAAAA", r: 0.000},
   168  	{a: "A", b: "", r: 0.000},
   169  	{a: "AA", b: "", r: 0.000},
   170  	{a: "AAA", b: "", r: 0.000},
   171  	{a: "AAAA", b: "", r: 0.000},
   172  	{a: "AAAAA", b: "", r: 0.000},
   173  	{a: "A", b: "B", r: 0.000},
   174  	{a: "AA", b: "BB", r: 0.000},
   175  	{a: "AAA", b: "BBB", r: 0.000},
   176  	{a: "AAAA", b: "BBBB", r: 0.000},
   177  	{a: "AAAAa", b: "BBBBB", r: 0.000},
   178  }
   179  

View as plain text