fixing bad mappings

This commit is contained in:
Kyattsukuro 2026-03-28 12:31:58 +01:00
parent 067afb1515
commit 7a7479314d
6 changed files with 17 additions and 20 deletions

View File

@ -1 +0,0 @@
,someone,nixLap,28.03.2026 12:13,file:///home/someone/.config/yolk/eggs/libreoffice/4;

View File

@ -1 +0,0 @@
,someone,nixLap,28.03.2026 12:13,file:///home/someone/.config/yolk/eggs/libreoffice/4;

View File

@ -38,7 +38,7 @@ SPICIES = {
"P.pip.",
"P.pip",
"PPIP",
"P.p."
"P.p.",
"ppip",
"Pipistrellus pipistrellus",
],
@ -180,7 +180,7 @@ SPICIES = {
"unbekannt",
"unb.",
"Unbestimmt",
"Mspecbech"
"Mspecbech",
],
"Malc": [
"M.alc.",
@ -256,7 +256,7 @@ SPICIES = {
"MMYO",
"mmyo",
"Myotis Myotis",
"Mspec.bech"
"Mspec.bech",
"M.m.",
"M.m",
"MM",
@ -310,18 +310,18 @@ CATCHED_BY = [
AGE = {
"j": [
"j",
"juv"
"juv",
],
"sub": [
"sub",
"subad",
"sub ad"
"sub ad",
"sub adult",
"sub-adult"
"sub-adult",
],
"a": [
"a",
"ad"
"ad",
]
}
@ -329,15 +329,15 @@ REPRODUCTION = {
"p": [
"plak",
"pl",
"p"
"p",
],
"g": [
"g"
"g",
],
"z": [
"lak",
"l",
"z"
"z",
]
}

View File

@ -24,12 +24,10 @@ COL_INSTRUCTIONS = {
{
"command": "FIND_AND_REPLACE",
"map": REPRODUCTION,
"reqire_full_match": True
},
{
"command": "FIND_AND_REPLACE",
"map": AGE,
"reqire_full_match": True
},
{
"command": "REGEX_MOVE_TO_COL",
@ -58,7 +56,8 @@ COL_INSTRUCTIONS = {
},
("Art",): {
"command": "FIND_AND_REPLACE",
"map": SPICIES
"map": SPICIES,
"reqire_full_match": True
},
("Ort",): {
"command": "REGEX_MOVE_TO_COL",

View File

@ -9,11 +9,11 @@ class FindAndReplace:
def execute_on_cell(self, entry) -> str:
res = deepcopy(entry.value)
for species, alternatives in self.map.items():
for old_version in alternatives:
if self.require_full_match and old_version == res:
for correct_name, bad_names in self.map.items():
for bad_name in bad_names:
if self.require_full_match and bad_name == res:
# Todo remove random leading/trailing spaces before if
res = species
res = correct_name
elif not self.require_full_match:
res = res.replace(old_version, species)
res = res.replace(bad_name, correct_name)
return res

Binary file not shown.