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

View File

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

View File

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

Binary file not shown.