Z21875

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z21875"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z21739",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z610",
            "Z16K2": "def Z21739(Z21739K1):\n\tword = Z21739K1\n\timport re\n\t\n\tU_PATTERN = re.compile(r\"^u[bcdfghjklmpqrstvwxyz][aeiou]\")\n\tCASE_SENSITIVE_EXCEPTIONS = {\n\t\t\"Ewe\": \"an\"\n\t}\n\tEXCEPTIONS_DICT = {\n\t\tword.lower(): \"a\" for word in [ \"NASA\", \"once\", \"one\", \"onesie\", \"Uniat\", \"Uniate\", \"uniaxial\", \"unibody\", \"unibrow\", \"unicameral\", \"UNICEF\", \"unicellular\", \"unicorn\", \"unicycle\", \"unidimensional\", \"unidirectional\", \"unification\", \"unified\", \"unifoliate\", \"unifoliolate\", \"uniform\", \"uniformity\", \"unilateral\", \"unilateralism\", \"unilineal\", \"unilinear\", \"unilingual\", \"unilocular\", \"uninucleate\", \"union\", \"unionism\", \"unionist\", \"unionization\", \"unionized\", \"uniparental\", \"unipolar\", \"unique\", \"unisex\", \"unisexual\", \"unison\", \"unit\", \"unitage\", \"unitard\", \"united\", \"uniter\", \"unitive\", \"unitrust\", \"unity\", \"univalent\", \"univalve\", \"univariate\", \"univerbation\", \"universal\", \"universalism\", \"universalistic\", \"universality\", \"universe\", \"university\", \"univocal\"]\n\t}\n\tEXCEPTIONS_DICT.update({\n\t\tword.lower(): \"an\" for word in [\n\t\t\t\"heir\", \"heirloom\", \"herb\", \"heuristic\", \"honest\", \"honestly\", \"honesty\", \"honor\", \"honorarium\", \"honorary\", \"honour\", \"hour\", \"hourly\"\n\t\t]\n\t})\n\tINITIALISM_LETTERS = {\"A\", \"E\", \"F\", \"H\", \"I\", \"L\", \"M\", \"N\", \"O\", \"R\", \"S\", \"X\"}\n\tREGULAR_VOWELS = {\"a\", \"e\", \"i\", \"o\"}\n\tCONSONANTS = set(\"bcdfghjklmnpqrstvwxyz\")\n\n\t# 1: If the word is an empty string, return an empty string\n\tif not word:\n\t\treturn \"\"\n\n\t# 2: If the word is a case-sensitive exception, return the match\n\tif word in CASE_SENSITIVE_EXCEPTIONS:\n\t\treturn CASE_SENSITIVE_EXCEPTIONS[word]\n\n\tword_lower = word.lower()\n\n\t# 3: If the word is an exception, return the match\n\tif word_lower in EXCEPTIONS_DICT:\n\t\treturn EXCEPTIONS_DICT[word_lower]\n\n\tfirst_letter = word[0]\n\tfirst_letter_lower = first_letter.lower()\n\n\t# 4: If the word is a number that uses \"an\", return that\n\tif first_letter == \"8\" or ((word.startswith(\"11\") or word.startswith(\"18\")) and len(word) not in [3, 4]):\n\t\treturn \"an\"\n\n\t# 5: If the word is 1 letter, it is likely a letter name\n\tif len(word) == 1:\n\t\treturn \"an\" if first_letter.upper() in INITIALISM_LETTERS else \"a\"\n\t\t\n\t# 6: If the word starts with 2 or more capital letters, it is likely an initialism\n\t#! NOTE: this mishandles acronyms\n\tif first_letter.isupper() and word[1].isupper():\n\t\treturn \"an\" if first_letter.upper() in INITIALISM_LETTERS else \"a\"\n\t\t\n\t# 7: If the word is 3 or more letters long and starts with a capital letter and a period, it is likely an initialism\t\n\tif first_letter.isupper() and len(word) \u003E= 3 and word[1] == \".\":\n\t\treturn \"an\" if first_letter.upper() in INITIALISM_LETTERS else \"a\"\n\n\t# 8: If the word starts with a U, handle it\n\tif first_letter_lower == \"u\":\n\t\tif U_PATTERN.match(word_lower):\n\t\t\treturn \"a\"\n\t\treturn \"an\"\n\n\t# 9: If the word starts with an eu or ew, handle it\n\tif len(word) \u003E= 3 and (word_lower.startswith(\"eu\") or word_lower.startswith(\"ew\")):\n\t\tif word_lower[2] in CONSONANTS or word_lower == \"ewe\":\n\t\t\treturn \"a\"\n\n\t# 10: If the word starts with one of the 4 other vowels, return it\n\tif first_letter_lower in REGULAR_VOWELS:\n\t\treturn \"an\"\n        \n\treturn \"a\"\n"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "Indefinite article from subsequent word, python"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1004",
                "Z11K2": "« an » ou « a » en anglais ?, en Python (2)"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11"
        ]
    }
}