mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 05:57:11 +00:00
aliases twiddle
This commit is contained in:
@@ -664,7 +664,7 @@ def read_cave(filename, mvf=None, cave=None):
|
||||
letter = "a"
|
||||
message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
|
||||
#eurl = f"{cave.url}_cave_edit/"
|
||||
eurl = Path(cave.url).parent + f"{cave.slug()}_cave_edit/"
|
||||
eurl = Path(cave.url).parent / f"{cave.slug()}_cave_edit/"
|
||||
# edit recognizer: (?P<path>.*)/(?P<slug>[^/]+)_cave_edit/$
|
||||
DataIssue.objects.create(parser="entrances", message=message, url=eurl)
|
||||
print(message)
|
||||
|
||||
@@ -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