Functional Weave
Code in Python

legal.conflict-name-match@1.0.1

vectors.json

5,569 bytes · view raw

[
 {
  "name": "Winkler's MARTHA/MARHTA: 0.9611; a company form and case do not stop an exact match",
  "args": [
   "Martha",
   [
    "marhta",
    "Dwayne",
    "MARTHA LTD",
    "Jones"
   ],
   9000
  ],
  "expect": [
   {
    "index": 2,
    "candidate": "MARTHA LTD",
    "matchKey": "martha",
    "score": 10000
   },
   {
    "index": 0,
    "candidate": "marhta",
    "matchKey": "marhta",
    "score": 9611
   }
  ]
 },
 {
  "name": "Winkler's DWAYNE/DUANE: exactly 0.84",
  "args": [
   "Dwayne",
   [
    "Duane"
   ],
   0
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "Duane",
    "matchKey": "duane",
    "score": 8400
   }
  ]
 },
 {
  "name": "Winkler's DIXON/DICKSONX: 0.8133, included at a threshold of 8133",
  "args": [
   "Dixon",
   [
    "Dicksonx"
   ],
   8133
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "Dicksonx",
    "matchKey": "dicksonx",
    "score": 8133
   }
  ]
 },
 {
  "name": "and excluded one basis point higher",
  "args": [
   "Dixon",
   [
    "Dicksonx"
   ],
   8134
  ],
  "expect": []
 },
 {
  "name": "word order does not matter: 'Smith, John' is 'john smith'",
  "args": [
   "John Smith",
   [
    "Smith, John",
    "SMITH John"
   ],
   10000
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "Smith, John",
    "matchKey": "john smith",
    "score": 10000
   },
   {
    "index": 1,
    "candidate": "SMITH John",
    "matchKey": "john smith",
    "score": 10000
   }
  ]
 },
 {
  "name": "Ltd, Limited and PLC are dropped; equal scores stay in input order",
  "args": [
   "Acme Holdings Limited",
   [
    "Acme Holdings PLC",
    "ACME HOLDINGS LTD.",
    "Acme Holdings Ltd"
   ],
   10000
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "Acme Holdings PLC",
    "matchKey": "acme holdings",
    "score": 10000
   },
   {
    "index": 1,
    "candidate": "ACME HOLDINGS LTD.",
    "matchKey": "acme holdings",
    "score": 10000
   },
   {
    "index": 2,
    "candidate": "Acme Holdings Ltd",
    "matchKey": "acme holdings",
    "score": 10000
   }
  ]
 },
 {
  "name": "'&' is 'and', and LLP is dropped",
  "args": [
   "Smith & Jones LLP",
   [
    "Smith and Jones"
   ],
   10000
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "Smith and Jones",
    "matchKey": "and jones smith",
    "score": 10000
   }
  ]
 },
 {
  "name": "apostrophes and full stops vanish: O'Neill is ONeill",
  "args": [
   "O'Neill",
   [
    "ONEILL",
    "O’Neill"
   ],
   10000
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "ONEILL",
    "matchKey": "oneill",
    "score": 10000
   },
   {
    "index": 1,
    "candidate": "O’Neill",
    "matchKey": "oneill",
    "score": 10000
   }
  ]
 },
 {
  "name": "below Jaro 0.7 there is no prefix boost: Amir/Amos is 6667, not 7333",
  "args": [
   "Amir",
   [
    "Amos"
   ],
   0
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "Amos",
    "matchKey": "amos",
    "score": 6667
   }
  ]
 },
 {
  "name": "a dropped letter: John/Jon 0.9333",
  "args": [
   "John",
   [
    "Jon"
   ],
   9000
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "Jon",
    "matchKey": "jon",
    "score": 9333
   }
  ]
 },
 {
  "name": "an empty or form-only candidate scores 0, reported only at threshold 0",
  "args": [
   "John",
   [
    "",
    "Ltd",
    "Jon"
   ],
   0
  ],
  "expect": [
   {
    "index": 2,
    "candidate": "Jon",
    "matchKey": "jon",
    "score": 9333
   },
   {
    "index": 0,
    "candidate": "",
    "matchKey": "",
    "score": 0
   },
   {
    "index": 1,
    "candidate": "Ltd",
    "matchKey": "",
    "score": 0
   }
  ]
 },
 {
  "name": "accented letters are kept, not folded: José/Jose 0.8833",
  "args": [
   "José",
   [
    "Jose"
   ],
   8000
  ],
  "expect": [
   {
    "index": 0,
    "candidate": "Jose",
    "matchKey": "jose",
    "score": 8833
   }
  ]
 },
 {
  "name": "best first: higher scores lead regardless of input order",
  "args": [
   "Martha",
   [
    "Dwayne",
    "marhta",
    "Martha"
   ],
   9000
  ],
  "expect": [
   {
    "index": 2,
    "candidate": "Martha",
    "matchKey": "martha",
    "score": 10000
   },
   {
    "index": 1,
    "candidate": "marhta",
    "matchKey": "marhta",
    "score": 9611
   }
  ]
 },
 {
  "name": "no candidates, no matches",
  "args": [
   "Anyone",
   [],
   0
  ],
  "expect": []
 },
 {
  "name": "a name that normalises to nothing is an error",
  "args": [
   "Ltd.",
   [
    "Acme"
   ],
   8500
  ],
  "expectError": "name is empty after normalising"
 },
 {
  "name": "a threshold over 10000 is an error",
  "args": [
   "Acme",
   [
    "Acme"
   ],
   10001
  ],
  "expectError": "thresholdBasisPoints must be between 0 and 10000"
 },
 {
  "name": "a negative threshold is an error",
  "args": [
   "Acme",
   [
    "Acme"
   ],
   -1
  ],
  "expectError": "thresholdBasisPoints must be between 0 and 10000"
 },
 {
  "name": "a name over 500 characters is an error",
  "args": [
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   [
    "Acme"
   ],
   8500
  ],
  "expectError": "names must be at most 500 characters after normalising"
 }
]