from ..get_list import get_raw_list, get_spoken_form_from_list FORMATTERS = { "rangeExclusive": lambda start, end: f"between {start} and {end}", "rangeInclusive": lambda start, end: f"{start} through {end}", "rangeExcludingStart": lambda start, end: f"end of {start} through {end}", "rangeExcludingEnd": lambda start, end: f"{start} until start of {end}", "verticalRange": lambda start, end: f"{start} vertically through {end}", } def get_compound_targets(): list_connective_term = get_spoken_form_from_list( "list_connective", "listConnective" ) vertical_range_term = get_spoken_form_from_list("range_type", "verticalRange") return [ { "id": "listConnective", "type": "compoundTargetConnective", "variations": [ { "spokenForm": f" {list_connective_term} ", "description": " and ", }, ], }, *[ get_entry(spoken_form, id) for spoken_form, id in get_raw_list("range_connective").items() ], get_entry(vertical_range_term, "verticalRange"), ] def get_entry(spoken_form, id): formatter = FORMATTERS[id] return { "id": id, "type": "compoundTargetConnective", "variations": [ { "spokenForm": f" {spoken_form} ", "description": formatter("", ""), }, { "spokenForm": f"{spoken_form} ", "description": formatter("selection", ""), }, ], }