File size: 441 Bytes
99812b0
58c5e94
99812b0
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from difflib import get_close_matches

# Simple mapping from English label to Danish synonym
mapping = {
    "french_fries": "pommes frites",
    "pizza": "pizza",
    "ice_cream": "is",
    "apple_pie": "æbletærte",
    "grilled_salmon": "grillet laks"
    # ... tilføj flere som ønsket
}

def oversæt_fuzzy(label):
    match = get_close_matches(label, mapping.keys(), n=1, cutoff=0.5)
    return mapping[match[0]] if match else label