1 """Utilities for determing name variants.
3 Copyright (c) Andrew Flegg <andrew@bleb.org> 2009.
4 Released under the Artistic Licence."""
7 ['Andrew', 'Andy', 'Andi', 'Drew'],
8 ['Christian', 'Chris'],
9 ['Christopher', 'Chris'],
11 ['Daniel', 'Dan', 'Danny'],
12 ['Michael', 'Mike', 'Mic', 'Mik', 'Micky'],
14 ['Robert', 'Rob', 'Bob', 'Bobby', 'Robbie'],
20 if (not name in __map__):
21 __map__[name] = set(row)
23 __map__[name] = __map__[name].union(row)
25 # -----------------------------------------------------------------------
27 """Return a set of names which should be checked for given the input
28 name. Any word which is has a replacement will be replaced, and an
29 iterable list of all variants will be returned."""
36 bits = name.split(' ')
39 for replacement in __map__[bit]:
40 result.add(name.replace(bit, replacement))