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