Z27414

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z27414"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z27410",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z600",
            "Z16K2": "function Z27410( Z27410K1, Z27410K2 ) {\n\tconst instanceOfPIDs=[\"P31\",\"P1552\"];\n\tconst languageStylePIDs=[\"P6191\"];\n\tconst characteristicsRank=[\n\t\t\t//negative characteristics\n\t\t\t\"Q54948374\",\t//depreciative\n\t\t\t\"Q54944750\",\t//potential\n\t\t\t\"Q56161479\",\t//incorrect\n\t\t\t\"Q56247521\",\t//former\n\t\t\t\"Q54943392\",\t//obsolete\n\t\t\t\"Q55094451\",\t//rare\n\t\t\t\"Q101583900\",\t//alternative spelling\n\t\t\t\"Q55228835\",\t//colloquial\n\t\t\t\n\t\t\t//neuter characteristics\n\t\t\t\"Q55082724\",\t//vocalic\n\t\t\t\"Q55082712\",\t//not vocalic\n\t\t\t\"Q55464014\",\t//weak form\n\t\t\t\"Q55464002\",\t//string form\n\t\t\t\n\t\t\t//positive characteristics\n\t\t\t\"Q101583918\",\t//reccomended by Duden\n\t\t\t\"Q54948995\",\t//non-depreciative\n\t\t];\n\t\n\tconst styleRank=[\n\t\t\"Q184439\",\t\t//profanity\n\t\t\"Q1521634\",\t\t//vulgarism\n\t\t\"Q545779\",\t\t//pejorative\n\t\t\"Q83464\",\t\t//euphemism\n\t\t\"Q58233068\",\t//humorous\n\t\t\"Q58157328\",\t//rare\n\t\t\"Q901711\",\t\t//colloqual\n\t\t\"Q181970\",\t\t//archaism\n\t\t\"Q57495609\",\t//outdated\n\t\t\"Q110983878\",\t//idiomatic\n\t\t\"Q130989\",\t\t//neologism\n\t\t];\n\t\t\n\tfunction valuesOfStatementOfForm(s,p){\n\t\t//p is a list\n\t\tlet retList=[]\n\t\tfor (let c of s.Z6004K5){\n\t\t\tif (c.Z6003K4.Z6040K1?.Z9K1 === \"Z6043\"){\n\t\t\t\t//Ignore deprecated rank\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (p.find((a)=\u003Ea===c.Z6003K2.Z6092K1) != undefined){\n\t\t\t\tretList.push(c.Z6003K3.Z6091K1);\n\t\t\t}\n\t\t}\n\t\treturn retList;\n\t}\n\tfunction compare(a,b){\n\t\tlet gooda=0, goodb=0;\n\t\tlet bada=0,badb=0;\n\t\tfor (let f of a.Z6004K4){\n\t\t\tif (Z27410K2.find((v)=\u003Ev.Z6091K1 === f.Z6091K1)!=undefined){\n\t\t\t\tgooda++;\n\t\t\t} else {\n\t\t\t\tbada++;\n\t\t\t}\n\t\t}\n\t\tfor (let f of b.Z6004K4){\n\t\t\tif (Z27410K2.find((v)=\u003Ev.Z6091K1 === f.Z6091K1)!=undefined){\n\t\t\t\tgoodb++;\n\t\t\t} else {\n\t\t\t\tbadb++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (gooda !== goodb){\n\t\t\treturn gooda\u003Cgoodb;\n\t\t}\n\t\tif (bada !== badb){\n\t\t\treturn bada \u003E badb;\n\t\t}\n\t\t\n\t\tconst sa=valuesOfStatementOfForm(a,instanceOfPIDs);\n\t\tconst sb=valuesOfStatementOfForm(b,instanceOfPIDs);\n\t\t\n\t\tconst sav=Math.min(...sa.map((v)=\u003E{\n\t\t\treturn characteristicsRank.findIndex((a)=\u003Ea===v);\n\t\t}));\n\t\tconst sbv=Math.min(...sb.map((v)=\u003E{\n\t\t\treturn characteristicsRank.findIndex((a)=\u003Ea===v);\n\t\t}));\n\t\t\n\t\tif (sav !== sbv){\n\t\t\treturn sav\u003Csbv;\n\t\t}\n\t\t\n\t\t// language style\n\t\tconst lsa=valuesOfStatementOfForm(a,languageStylePIDs);\n\t\tconst lsb=valuesOfStatementOfForm(b,languageStylePIDs);\n\t\tconst lsav=Math.min(...lsa.map((v)=\u003E{\n\t\t\treturn styleRank.findIndex((a)=\u003Ea===v);\n\t\t}));\n\t\tconst lsbv=Math.min(...lsb.map((v)=\u003E{\n\t\t\treturn styleRank.findIndex((a)=\u003Ea===v);\n\t\t}));\n\t\tif (lsbv !== lsav){\n\t\t\treturn lsav\u003Clsbv;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tlet bestForm=null;\n\t\n\tif (Z27410K1.Z6005K7.length===0){\n\t\tWikifunctions.Error(\"Z28259\",[Z27410K1.Z6005K1.Z6095K1]);\n\t}\n\t\n\tfor (let currForm of Z27410K1.Z6005K7){\n\t\tif (bestForm===null){\n\t\t\tbestForm=currForm;\n\t\t} else if (compare(bestForm,currForm)){\n\t\t\tbestForm=currForm;\n\t\t}\n\t}\n\t\n\treturn bestForm.Z6004K3.Z12K1[0].Z11K2;\n}"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1787",
                "Z11K2": "miglior stringa di rappr. di lessema comp., js"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "better matching representation from lexeme, js"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11"
        ]
    }
}