mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 22:57:09 +00:00
aliases twiddle
This commit is contained in:
@@ -338,23 +338,31 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
== "Mike Rickardson".
|
||||
"""
|
||||
global Gpersonexpeditionnamelookup
|
||||
|
||||
def apply_initials(variations, a, l):
|
||||
variations.append(a + l)
|
||||
variations.append(a + " " + l)
|
||||
variations.append(a + " " + l[0])
|
||||
variations.append(a + l[0])
|
||||
variations.append(a + " " + l[0] + ".")
|
||||
variations.append(a[0] + " " + l)
|
||||
variations.append(a[0] + ". " + l)
|
||||
variations.append(a[0] + l)
|
||||
variations.append(a[0] + l[0]) # initials e.g. gb or bl
|
||||
return variations
|
||||
|
||||
def apply_variations(f, l):
|
||||
def apply_variations(f, l, n=""):
|
||||
"""Be generous in guessing possible matches. Any duplicates will be ruled as invalid."""
|
||||
f = f.lower()
|
||||
l = l.lower()
|
||||
variations = []
|
||||
variations.append(f)
|
||||
variations.append(l)
|
||||
variations.append(f + l)
|
||||
variations.append(f + " " + l)
|
||||
variations.append(f + " " + l[0])
|
||||
variations.append(f + l[0])
|
||||
variations.append(f + " " + l[0] + ".")
|
||||
variations.append(f[0] + " " + l)
|
||||
variations.append(f[0] + ". " + l)
|
||||
variations.append(f[0] + l)
|
||||
variations.append(f[0] + l[0]) # initials e.g. gb or bl
|
||||
variations = apply_initials(variations, f, l)
|
||||
if n:
|
||||
variations.append(n)
|
||||
variations = apply_initials(variations, n, f)
|
||||
variations = apply_initials(variations, n, l)
|
||||
return variations
|
||||
|
||||
res = Gpersonexpeditionnamelookup.get(expedition.name)
|
||||
@@ -381,11 +389,9 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
possnames.append(n)
|
||||
|
||||
if l:
|
||||
possnames += apply_variations(f, l)
|
||||
|
||||
if n:
|
||||
possnames += apply_variations(n, l)
|
||||
possnames += apply_variations(f, l, n)
|
||||
|
||||
|
||||
if f == "Adeleide".lower():
|
||||
possnames += apply_variations("Adelaide", l)
|
||||
if f == "Adelaide".lower():
|
||||
|
||||
Reference in New Issue
Block a user