mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 17:47:03 +00:00
aliases twiddle
This commit is contained in:
@@ -664,7 +664,7 @@ def read_cave(filename, mvf=None, cave=None):
|
|||||||
letter = "a"
|
letter = "a"
|
||||||
message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
|
message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
|
||||||
#eurl = f"{cave.url}_cave_edit/"
|
#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/$
|
# edit recognizer: (?P<path>.*)/(?P<slug>[^/]+)_cave_edit/$
|
||||||
DataIssue.objects.create(parser="entrances", message=message, url=eurl)
|
DataIssue.objects.create(parser="entrances", message=message, url=eurl)
|
||||||
print(message)
|
print(message)
|
||||||
|
|||||||
@@ -339,22 +339,30 @@ def GetPersonExpeditionNameLookup(expedition):
|
|||||||
"""
|
"""
|
||||||
global Gpersonexpeditionnamelookup
|
global Gpersonexpeditionnamelookup
|
||||||
|
|
||||||
def apply_variations(f, l):
|
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, n=""):
|
||||||
"""Be generous in guessing possible matches. Any duplicates will be ruled as invalid."""
|
"""Be generous in guessing possible matches. Any duplicates will be ruled as invalid."""
|
||||||
f = f.lower()
|
f = f.lower()
|
||||||
l = l.lower()
|
l = l.lower()
|
||||||
variations = []
|
variations = []
|
||||||
variations.append(f)
|
variations.append(f)
|
||||||
variations.append(l)
|
variations.append(l)
|
||||||
variations.append(f + l)
|
variations = apply_initials(variations, f, l)
|
||||||
variations.append(f + " " + l)
|
if n:
|
||||||
variations.append(f + " " + l[0])
|
variations.append(n)
|
||||||
variations.append(f + l[0])
|
variations = apply_initials(variations, n, f)
|
||||||
variations.append(f + " " + l[0] + ".")
|
variations = apply_initials(variations, n, l)
|
||||||
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
|
|
||||||
return variations
|
return variations
|
||||||
|
|
||||||
res = Gpersonexpeditionnamelookup.get(expedition.name)
|
res = Gpersonexpeditionnamelookup.get(expedition.name)
|
||||||
@@ -381,10 +389,8 @@ def GetPersonExpeditionNameLookup(expedition):
|
|||||||
possnames.append(n)
|
possnames.append(n)
|
||||||
|
|
||||||
if l:
|
if l:
|
||||||
possnames += apply_variations(f, l)
|
possnames += apply_variations(f, l, n)
|
||||||
|
|
||||||
if n:
|
|
||||||
possnames += apply_variations(n, l)
|
|
||||||
|
|
||||||
if f == "Adeleide".lower():
|
if f == "Adeleide".lower():
|
||||||
possnames += apply_variations("Adelaide", l)
|
possnames += apply_variations("Adelaide", l)
|
||||||
|
|||||||
Reference in New Issue
Block a user