function grammatikkuerzel(text) { const grammatikkzl = { "a. a. O." : "am angegebenen Ort", "abh." : "abhängig", "Adj." : "Adjektiv", "Adv." : "Adverb", "afrz." : "altfranzösisch", "ahd." : "althochdeutsch", "Akk. d. P." : "Akkusativ der Person", "Akk." : "Akkusativ", "alem." : "alemannisch", "Anm." : "Anmerkung", "anV." : "unregelmäßig flektiertes Verb", "Apok." : "Apokope", "Art." : "Artikel", "AT" : "Altes Testament", "Attr." : "Attribut", "ausl." : "auslautend", "bair." : "bairisch", "bes." : "besonders", "best." : "bestimmt", "böhm." : "böhmisch", "d. i." : "das ist", "Dat. d. Pers." : "Dativ der Person", "d. P." : "der Person", "Dat." : "Dativ", "Dehng." : "Dehnung", "Dekl." : "Deklination", "Dem.-Pron." : "Demonstrativpronomen", "dem." : "demonstrativ", "ders." : "derselbe", "dgl." : "dergleichen", "dies." : "dieselbe", "Dimin." : "Diminutiv", "Diphth." : "Diphthong(ierung)", "dir." : "direkt", "Dissim." : "Dissimilation", "dt." : "deutsch", "Ed." : "Editor", "elsäss." : "elsässisch", "EN" : "Eigenname(n)", "engl." : "englisch", "Entrdg." : "Entrundung", "etym." : "etymologisch", "europ." : "europäisch", "Fem.": "Femininum", "flekt." : "flektiert", "Forts." : "Fortsetzung", "frk." : "fränkisch", "frnhd." : "frühneuhochdeutsch", "frz." : "französisch", "Fut." : "Futur", "Gem." : "Gemination / Geminata", "Gen. d. S." : "Genitiv der Sache", "Gen. def." : "Genitivus definitus", "Gen. expl." : "Genitivus explicativus", "Gen. obj." : "Genitivus objectivus", "Gen.-Obj." : "Genitiv-Objekt", "Gen. part." : "Genitivus partitivus", "Gen. poss." : "Genitivus possessivus", "Gen. propr." : "Genitivus proprietatis", "Gen. subj." : "Genitivus subjectivus", "Gen." : "Genitiv", "germ." : "germanisch", "geschr." : "geschrieben", "ggf." : "gegebenenfalls", "got." : "gotisch", "griech." : "griechisch", "hess." : "hessisch", "hg. v." : "herausgegeben von", "Hrsg." : "Herausgeber", "Hs." : "Handschrift", "Hss." : "Handschriften", "Hsl." : "handschriftlich", "hsl." : "handschriftlich", "i. d. R." : "in der Regel", "Imp." : "Imperativ", "Ind." : "Indikativ", "indef." : "indefinit", "Indef.-Pron." : "Indefinitpronomen", "indir." : "Indirekt", "Inf." : "Infinitiv", "inl." : "inlautend", "insbes." : "insbesondere", "Instr." : "instrumental", "interr." : "interrogativ", "Interr.-Pron." : "Interrogativpronomen", "intrans." : "intransitiv", "i. S. v." : "im Sinne von", "Jh." : "Jahrhundert", "Jh.s" : "Jahrhunderts", "jmd." : "jemand", "kombinat." : "kombinatorisch", "Komp." : "Komparativ", "kondit." : "konditional", "Konj." : "Konjunktiv", "Konjugat." : "Konjugation", "Kons." : "Konsonant(ismus)", "Kontr." : "Kontraktion", "Kürzg." : "Kürzung", "lat." : "lateinisch", "Mask." : "Maskulinum", "md." : "mitteldeutsch", "Mda." : "Mundart", "Mdaa." : "Mundarten", "mdal." : "mundartlich", "mfrk." : "mittelfränkisch", "mhd." : "mittelhochdeutsch", "mlat." : "mittellateinisch", "mnd." : "mittelniederdeutsch", "mndd." : "mittelniederdeutsch", "mndl." : "mittelniederländisch", "mnl." : "mittelniederländisch", "Monophth." : "Monophthong(ierung)", "nd." : "niederdeutsch", "ndd." : "niederdeutsch", "ndrh." : "niederrheinisch", "Neutr." : "Neutrum", "neutr." : "neutral", "nhd." : "neuhochdeutsch", "Nom." : "Nominativ", "NT" : "Neues Testament", "Num." : "Numerus", "o. A." : "ohne Autor", "o. O." : "ohne Ort", "obd." : "oberdeutsch", "obersächs." : "obersächsisch", "Obj." : "Objekt", "ofrk." : "ostfränkisch", "omd." : "ostmitteldeutsch", "ON" : "Ortsname", "Opt." : "Optativ", "österr." : "österreichisch", "Part." : "Partizip", "Perf." : "Perfekt", "periphr." : "periphrastisch", "Pers.-Pron." : "Personalpronomen", "Pers." : "Person", "pl. t." : "plurale tantum", "Pl." : "Plural", "PN" : "Personenname(n)", "Poss.-Pron." : "Possessivpronomen", "poss." : "possessiv, Possessivum", "PP" : "Präpositionalphrase", "präd." : "prädikativ", "Präp." : "Präposition", "Präs." : "Präsens", "Prät." : "Präteritum", "Pron." : "Pronomen", "Rdg." : "Rundung", "redupl." : "reduplizierend", "Refl.-Pron." : "Reflexivpronomen", "refl." : "reflexiv", "Rel.-Pron." : "Relativpronomen", "relat." : "relativ(isch)", "rhfrk." : "rheinfränkisch", "rip." : "ripuarisch", "rom." : "romanisch", "s. v." : "sub voce", "sächs." : "sächsisch", "sc." : "scilicet, nämlich", "schwäb." : "schwäbisch", "sem." : "semantisch", "Senkg." : "Senkung", "sg. t." : "singulare tantum", "Sg." : "Singular", "Slg." : "Sammlung", "sog." : "sogenannt", "stA." : "starkes Adjektiv", "stF." : "starkes Femininum", "stM." : "starkes Maskulinum", "stN." : "starkes Neutrum", "stV." : "starkes Verb", "st." : "stark", "sth." : "Stimmhaft", "stl." : "Stimmlos", "stswF" : "starkes/schwaches Femininum", "stswM." : "starkes/schwaches Maskulinum", "stswN." : "starkes/schwaches Neutrum", "Subj." : "Subjekt", "Subst." : "Substantiv", "Sup." : "Superlativ", "swA." : "schwaches Adjektiv", "swF." : "schwaches Femininum", "swM." : "schwaches Maskulinum", "swN." : "schwaches Neutrum", "swV." : "schwaches Verb", "sw." : "schwach", "Synk." : "Synkope", "synt." : "syntaktisch", "thür." : "thüringisch", "trans." : "transitiv", "u. ö." : "und öfter", "Uml." : "Umlaut", "unbest." : "unbestimmt", "unflekt." : "unflektiert", "unpers." : "unpersönlich", "urspr." : "urspru¨nglich", "verallg." : "verallgemeinert", "versch." : "verschieden", "Vf" : "finites Verb", "Vinf" : "infinites Verb", "Vok." : "Vokal(-ismus)", "Wb." : "Wörterbuch", "Wbb." : "Wörterbücher", "wmd." : "westmitteldeutsch", "1 Cor" : "Epistula ad Corinthios Iª / 1. Korintherbrief", "1 Esr" : "Ezrae Ius / Das Buch Esra", "1 Io" : "Epistula Iohannis Iª / 1. Johannesbrief", "1 Mcc" : "Macchabeorum Ius / 1. Makkabäer", "1 Par" : "Paralipomenon Ius / 1. Buch der Chronik", "1 Pt" : "Epistula Petri Iª / 1. Petrusbrief", "1 Sm" : "Samuelis seu I Regum / 1. Buch Samuel", "1 Th" : "Epistula ad Thessalonicenses Iª / 1. Thessalonikerbrief", "1 Tim" : "Epistula ad Timotheum Iª / 1. Timotheusbrief", "2 Cor" : "Epistula ad Corinthios IIª / 2. Korintherbrief", "2 Esr" : "Ezrae IIus (Nehemiae) / Das Buch Nehemia", "2 Io" : "Epistula Iohannis IIª / 2. Johannesbrief", "2 Mcc" : "Macchabeorum IIus / 2. Makkabäer", "2 Par" : "Paralipomenon IIus / 2. Buch der Chronik", "2 Pt" : "Epistula Petri IIª / 2. Petrusbrief", "2 Sm" : "Samuelis seu II Regum / 2. Buch Samuel", "2 Th" : "Epistula ad Thessalonicenses IIª / 2. Thessalonikerbrief", "2 Tim" : "Epistula ad Timotheum IIª / 2. Timotheusbrief", "3 Io" : "Epistula Iohannis IIIª / 3. Johannesbrief", "3 Rg" : "Malachim seu III Regum / 1. Buch der Könige", "4 Rg" : "Malachim seu IV Regum / 2. Buch der Könige", "Abd" : "Abdias Prophetae / Der Prophet Obadja", "Act" : "Actuum Apostolorum / Apostelgeschichte", "Agg" : "Aggei Prophetae / Der Prophet Haggai", "Apc" : "Apocalypsis Iohannis Apostoli / Die Offenbarung des Johannes", "Bar" : "Baruch Prophetae / Der Prophet Baruch", "Col" : "Epistula ad Colossenses / Kolosserbrief", "Ct" : "Canticum Canticorum / Das Hohe Lied", "Dn" : "Danihelis Prophetae / Der Prophet Daniel", "Dt" : "Deuteronomii / 5. Buch Mose", "Ecl" : "Ecclesiastes / Das Buch Kohelet", "Eph" : "Epistula ad Ephesios / Epheserbrief", "Est" : "Hester / Das Buch Esther", "Ex" : "Exodi / 2. Buch Mose", "Ez" : "Hiezechielis Prophetae / Der Prophet Hesekiel", "Gal" : "Epistula ad Galatas / Galaterbrief", "Gn" : "Genesis / 1. Buch Mose", "Hab" : "Abacuc Prophetae / Der Prophet Habakuk", "Hbr" : "Epistula ad Hebraeos / Hebräerbrief", "Iac" : "Epistula Iacobi / Jakobusbrief", "Idc" : "Iudicum / Das Buch der Richter", "Idt" : "Iudith / Das Buch Judith", "Ier" : "Hieremiae Prophetae / Der Prophet Jeremia", "Io" : "Evangelii secundum Iohannem / Johannesevangelium", "Iob" : "Iob / Das Buch Hiob", "Ioel" : "Iohelis Prophetae / Der Prophet Joel", "Ion" : "Ionae Prophetae / Der Prophet Jona", "Ios" : "Iosue / Das Buch Josua", "Is" : "Isaiae Prophetae / Der Prophet Jesaja", "Iud" : "Epistula Iudae / Judasbrief", "Lam" : "Threni, id est, Lamentationes / Klagelieder", "Lc" : "Evangelii secundum Lucam / Lukasevangelium", "Lv" : "Levitici / 3. Buch Mose", "Mal" : "Malachiae Prophetae / Der Prophet Maleachi", "Mc" : "Evangelii secundum Marcum / Markusevangelium", "Mi" : "Micha Prophetae / Der Prophet Micha", "Mt" : "Evangelii secundum Mattheum / Matthäusevangelium", "Na" : "Naum Prophetae / Der Prophet Nahum", "Nm" : "Numerorum / 4. Buch Mose", "Os" : "Osee Prophetae / Der Prophet Hosea", "Phil" : "Epistula ad Philippenses / Philipperbrief", "Phlm" : "Epistula ad Philemonem / Philemonbrief", "Prv" : "Proverbiorum / Die Sprüche Salomos", "Ps" : "Psalmi iuxta Septuaginta / Psalmen", "Rm" : "Epistula ad Romanos / Römerbrief", "Rt" : "Ruth / Das Buch Ruth", "Sap" : "Sapientiae Salomonis / Das Buch der Weisheit", "Sir" : "Iesu Filii Sirach, seu Ecclesiasticus / Das Buch Jesus Sirach", "Tb" : "Tobiae / Das Buch Tobit", "Tit" : "Epistula ad Titum / Titusbrief", "Za" : "Zacchariae Prophetae / Der Prophet Sacharja" }; var grammatikkzl_regex = ''; for (var kzl in grammatikkzl) grammatikkzl_regex = grammatikkzl_regex + '|' + RegExp_quote(kzl); grammatikkzl_regex = grammatikkzl_regex.replace(/^\|/,""); let re = new RegExp("("+grammatikkzl_regex+")","gi"); // Literatur-Spans ausnehmen const spans = []; // 1. Maskiere Strecken zwischen ... const masked = text.replace(/]*>.*?<\/span>/gs, function(match) { spans.push(match); return `__SPAN_BLOCK_${spans.length - 1}__`; }); const processed = masked.replace(re, function(a,b,pos,ges) { let t = ges[pos+a.length]; let p = a[a.length-1]; let bf = ges[pos-1]; if (/[a-zäöüâêîôûæœß\-]/i.test(bf)) return a; if (/[a-zäöüâêîôûæœß]/i.test(t)) return a; let k = b; for (const kzl in grammatikkzl) { let re = new RegExp("^"+RegExp_quote(kzl)+"$","i"); if (re.test(b)) { if (kzl != k && String(kzl[0]).toLowerCase() + String(kzl).slice(1) == k) return a; k = kzl; break; } } if (p == '.' || !/[a-zäöüâêîôûæœß]/i.test(t)) return ''+b.replace(/ /g," ")+''; else return a; }); const result = processed.replace(/__SPAN_BLOCK_(\d+)__/g, function(_, idx) { return spans[idx]; }); return result; }