File size: 471 Bytes
ed6bec6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# generator/dict_utils.py

from typing import Dict, Any


def is_defined(term_id: str, dictionaries: Dict[str, Any]) -> bool:
    """
    Checks if a term_id exists in ANY loaded dictionary.
    """
    if term_id is None:
        return False

    for _, entries in dictionaries.items():
        if not isinstance(entries, list):
            continue
        for entry in entries:
            if entry.get("id") == term_id:
                return True
    return False