import re
from typing import Dict, Pattern, List, Tuple
from .group import AxisRole


class Tag:
    __tablename__ = 'tag'


class Axis:
    __tablename__ = 'axis'

    @staticmethod
    def tag_2_level():
        return {'ART': 30, 'PRT': 21, 'TIT': 22, 'CHP': 23, 'SEC': 24, 'SUB': 25, 'PAR': 35, 'PHR': 36, 'LTR': 37, 'NUM': 36, 'DIGIT': 38, 'SUBPAR': 37, 'ANX': 20, 'DIR': 10, 'REG': 10, 'DEC': 10, 'FDC': 10, 'TRT': 9, 'REC': 11, 'PRE': 11, 'PT': 37, 'PG': 36}

    @staticmethod
    def tag_2_pattern(language) -> Dict[str, Pattern]:
        return {'ES': {'ART': re.compile(r'Artículos?', flags=34), 'PRT': re.compile(r'Partes?\b', flags=34), 'TIT': re.compile(r'Títulos?', flags=34), 'CHP': re.compile(r'Capítulos?', flags=34), 'SEC': re.compile(r'Secci(ón|ones)', flags=34), 'SUB': re.compile(r'Subsecci(ón|ones)', flags=34), 'PAR': re.compile(r'apartados?', flags=34), 'LTR': re.compile(r'letras?', flags=34), 'ANX': re.compile(r'Anexos?', flags=34), 'DIR': re.compile(r'Directivas?', flags=34), 'REG': re.compile(r'Reglamentos?( de Ejecución| Delegado)?', flags=34), 'DEC': re.compile(r'Decisi(ón|ones)', flags=34), 'FDC': re.compile(r'Decisi(ón|ones) marco', flags=34), 'TRT': re.compile(r'Tratados?', flags=34), 'PRE': re.compile(r'Preámbulos?', flags=34)}, 'DE': {'ART': re.compile(r'Art(\.|ikel[sn]?)', flags=34), 'PRT': re.compile(r'Teil(s|en?)?', flags=34), 'TIT': re.compile(r'Titel[sn]?', flags=34), 'CHP': re.compile(r'Kapitel[sn]?', flags=34), 'SEC': re.compile(r'Abschnitt(s|en?)?', flags=34), 'SUB': re.compile(r'Unterabschnitt(s|en?)?', flags=34), 'PAR': re.compile(r'Abs(\.|[aä]tz(e[sn]?)?)', flags=34), 'PHR': re.compile(r'S[aä]tz(e[sn]?)?', flags=34), 'LTR': re.compile(r'Buchst(\.|aben?)', flags=34), 'NUM': re.compile(r'Nummern?', flags=34), 'DIGIT': re.compile(r'Ziffern?', flags=34), 'SUBPAR': re.compile(r'Unterabs(\.|[aä]tz(e[ns]?)?)', flags=34), 'ANX': re.compile(r'Anh[aä]ng(s|en?)?\b', flags=34), 'DIR': re.compile(r'Richtlinien?', flags=34), 'REG': re.compile(r'(\bVO\b|(Durchführungsv|V)erordnung(en)?)', flags=34), 'DEC': re.compile(r'(Beschl[uü]sse?s?|Entscheidung(en)?)', flags=34), 'FDC': re.compile(r'Rahmenbeschl[uü]sse?s?', flags=34), 'TRT': re.compile(r'Vertr(ags?|ägen?)', flags=34), 'REC': re.compile(r'Erwägungsgr[uü]nde?', flags=34), 'PRE': re.compile(r'Päambeln?', flags=34)}, 'EN': {'ART': re.compile(r'Articles?', flags=34), 'PRT': re.compile(r'Parts?\b', flags=34), 'TIT': re.compile(r'Titles?', flags=34), 'CHP': re.compile(r'Chapters?', flags=34), 'SEC': re.compile(r'Sections?', flags=34), 'SUB': re.compile(r'Sub(-S|s)ections?', flags=34), 'PHR': re.compile(r'subparagraphs?', flags=34), 'ANX': re.compile(r'Annex(es)?\b', flags=34), 'DIR': re.compile(r'Directives?', flags=34), 'REG': re.compile(r'Regulations?', flags=34), 'DEC': re.compile(r'Decisions?', flags=34), 'FDC': re.compile(r'Framework Decisions?', flags=34), 'TRT': re.compile(r'Treat(y|ies)', flags=34), 'PRE': re.compile(r'Preambles?', flags=34), 'PT': re.compile(r'points?', flags=34), 'PG': re.compile(r'paragraphs?', flags=34)}}[language]

    @staticmethod
    def tag_2_role():
        return {'ART': AxisRole.leaf, 'PRT': AxisRole.container, 'TIT': AxisRole.container, 'CHP': AxisRole.container, 'SEC': AxisRole.container, 'SUB': AxisRole.container, 'PAR': AxisRole.paragraph, 'PHR': AxisRole.phrase, 'LTR': AxisRole.paragraph, 'NUM': AxisRole.paragraph, 'DIGIT': AxisRole.paragraph, 'SUBPAR': AxisRole.paragraph, 'ANX': AxisRole.annex, 'DIR': AxisRole.document, 'REG': AxisRole.document, 'DEC': AxisRole.document, 'FDC': AxisRole.document, 'TRT': AxisRole.document, 'REC': AxisRole.paragraph, 'PRE': AxisRole.leaf, 'PT': AxisRole.paragraph, 'PG': AxisRole.paragraph, 'named_entity': AxisRole.document, '': AxisRole.paragraph}

    @staticmethod
    def tag_2_standard(language) -> Dict[str, str]:
        return {'ES': {'ART': 'Art.', 'PRT': 'Parte', 'TIT': 'Título', 'CHP': 'Capítulo', 'SEC': 'Sección', 'SUB': 'Subsección', 'PAR': 'apartado', 'LTR': 'letra', 'ANX': 'Anexo', 'DIR': 'Directiva', 'REG': 'Reglamento', 'DEC': 'Decisión', 'FDC': 'Decisión marco', 'TRT': 'Tratado', 'PRE': 'Preámbulo'}, 'DE': {'ART': 'Art.', 'PRT': 'Teil', 'TIT': 'Titel', 'CHP': 'Kap.', 'SEC': 'Abschn.', 'SUB': 'Unterabschn.', 'PAR': 'Abs.', 'PHR': 'Satz', 'LTR': 'Buchst.', 'NUM': 'Num.', 'DIGIT': 'Ziff.', 'SUBPAR': 'Unterabs.', 'ANX': 'Anhang', 'DIR': 'Richtlinie', 'REG': 'Verordnung', 'DEC': 'Beschluss', 'FDC': 'Rahmenbeschluss', 'TRT': 'Vertrag', 'REC': 'Erwägungsgrund', 'PRE': 'Präambel'}, 'EN': {'ART': 'Article', 'PRT': 'Part', 'TIT': 'Title', 'CHP': 'Chapter', 'SEC': 'Section', 'SUB': 'Subsection', 'PHR': None, 'ANX': 'Annex', 'DIR': 'Directive', 'REG': 'Regulation', 'DEC': 'Decision', 'FDC': 'Framework Decision', 'TRT': 'Treaty', 'PRE': 'Preamble', 'PT': 'point', 'PG': 'paragraph'}}[language]


class AxisPattern:
    __tablename__ = 'axis_pattern'

    @staticmethod
    def languages():
        return {'ES', 'DE', 'EN'}


class Value:
    __tablename__ = 'value'
    backref = ('XPREVX', 'BRCRPL', 'THEREOF')

    @staticmethod
    def get_pattern_map(tag, language) -> Dict[str, Pattern]:
        return {('EULCOO', 'ES'): {}, ('EULCOO', 'DE'): {}, ('EULCOO', 'EN'): {}, ('EULCOO', 'XX'): {}, ('AL', 'ES'): {}, ('AL', 'DE'): {}, ('AL', 'EN'): {}, ('AL', 'XX'): {}, ('SRNK', 'ES'): {'1': re.compile(r'primer[oa]', flags=34), '10': re.compile(r'décim[oa]', flags=34), '11': re.compile(r'undécim[oa]', flags=34), '12': re.compile(r'duodécim[oa]', flags=34), '13': re.compile(r'decimotercer[oa]', flags=34), '14': re.compile(r'decimocuart[oa]', flags=34), '15': re.compile(r'decimoquint[oa]', flags=34), '16': re.compile(r'decimosext[oa]', flags=34), '17': re.compile(r'decimoséptim[oa]', flags=34), '18': re.compile(r'decimooctav[oa]', flags=34), '19': re.compile(r'decimonoven[oa]', flags=34), '2': re.compile(r'segund[oa]', flags=34), '20': re.compile(r'vijésim[oa]', flags=34), '3': re.compile(r'tercer[oa]', flags=34), '4': re.compile(r'cuart[oa]', flags=34), '5': re.compile(r'quint[oa]', flags=34), '6': re.compile(r'sext[oa]', flags=34), '7': re.compile(r'séptim[oa]', flags=34), '8': re.compile(r'octav[oa]', flags=34), '9': re.compile(r'noven[oa]', flags=34)}, ('SRNK', 'DE'): {'1': re.compile(r'erste[rsnm]?', flags=34), '10': re.compile(r'zehnte[rsnm]?', flags=34), '11': re.compile(r'elfte[rsnm]?', flags=34), '12': re.compile(r'zwölfte[rsnm]?', flags=34), '13': re.compile(r'dreizehnte[rsnm]?', flags=34), '14': re.compile(r'vierzehnte[rsnm]?', flags=34), '15': re.compile(r'fünfzehnte[rsnm]?', flags=34), '16': re.compile(r'sechzehnte[rsnm]?', flags=34), '17': re.compile(r'siebzehnte[rsnm]?', flags=34), '18': re.compile(r'achtzehnte[rsnm]?', flags=34), '19': re.compile(r'neunzehnte[rsnm]?', flags=34), '2': re.compile(r'zweite[rsnm]?', flags=34), '20': re.compile(r'zwanzigste[rsnm]?', flags=34), '3': re.compile(r'dritte[rsnm]?', flags=34), '4': re.compile(r'vierte[rsnm]?', flags=34), '5': re.compile(r'fünfte[rsnm]?', flags=34), '6': re.compile(r'sechste[rsnm]?', flags=34), '7': re.compile(r'siebte[rsnm]?', flags=34), '8': re.compile(r'achte[rsnm]?', flags=34), '9': re.compile(r'neunte[rsnm]?', flags=34)}, ('SRNK', 'EN'): {'1': re.compile(r'first', flags=34), '10': re.compile(r'tenth', flags=34), '11': re.compile(r'eleventh', flags=34), '12': re.compile(r'twelth', flags=34), '13': re.compile(r'thirteenth', flags=34), '14': re.compile(r'fourteenth', flags=34), '15': re.compile(r'fifteenth', flags=34), '16': re.compile(r'sixteenth', flags=34), '17': re.compile(r'seventeenth', flags=34), '18': re.compile(r'eighteenth', flags=34), '19': re.compile(r'nineteenth', flags=34), '2': re.compile(r'second', flags=34), '20': re.compile(r'twentieth', flags=34), '3': re.compile(r'third', flags=34), '4': re.compile(r'fourth', flags=34), '5': re.compile(r'fifth', flags=34), '6': re.compile(r'sixth', flags=34), '7': re.compile(r'seventh', flags=34), '8': re.compile(r'eighth', flags=34), '9': re.compile(r'ninth', flags=34)}, ('SRNK', 'XX'): {}, ('EUFCOO', 'ES'): {}, ('EUFCOO', 'DE'): {}, ('EUFCOO', 'EN'): {}, ('EUFCOO', 'XX'): {}, ('NSTNM', 'ES'): {}, ('NSTNM', 'DE'): {}, ('NSTNM', 'EN'): {}, ('NSTNM', 'XX'): {}, ('SPN', 'ES'): {'1': re.compile(r'uno', flags=34), '10': re.compile(r'diez', flags=34), '11': re.compile(r'once', flags=34), '12': re.compile(r'doce', flags=34), '13': re.compile(r'trece', flags=34), '14': re.compile(r'quatorce', flags=34), '15': re.compile(r'quince', flags=34), '16': re.compile(r'dieciseis', flags=34), '17': re.compile(r'diecisiete', flags=34), '18': re.compile(r'dieciocho', flags=34), '19': re.compile(r'diecinueve', flags=34), '2': re.compile(r'dos', flags=34), '20': re.compile(r'veinte', flags=34), '3': re.compile(r'tres', flags=34), '4': re.compile(r'cuatro', flags=34), '5': re.compile(r'cinco', flags=34), '6': re.compile(r'seis', flags=34), '7': re.compile(r'siete', flags=34), '8': re.compile(r'ocho', flags=34), '9': re.compile(r'nueve', flags=34)}, ('SPN', 'DE'): {'1': re.compile(r'eins', flags=34), '10': re.compile(r'zehn', flags=34), '11': re.compile(r'elf', flags=34), '12': re.compile(r'zwölf', flags=34), '13': re.compile(r'dreizehn', flags=34), '14': re.compile(r'vierzehn', flags=34), '15': re.compile(r'fünfzehn', flags=34), '16': re.compile(r'sechzehn', flags=34), '17': re.compile(r'siebzehn', flags=34), '18': re.compile(r'achtzehn', flags=34), '19': re.compile(r'neunzehn', flags=34), '2': re.compile(r'zwei', flags=34), '20': re.compile(r'zwanzig', flags=34), '3': re.compile(r'drei', flags=34), '4': re.compile(r'vier', flags=34), '5': re.compile(r'fünf', flags=34), '6': re.compile(r'sechs', flags=34), '7': re.compile(r'sieben', flags=34), '8': re.compile(r'acht', flags=34), '9': re.compile(r'neun', flags=34)}, ('SPN', 'EN'): {'1': re.compile(r'one', flags=34), '10': re.compile(r'ten', flags=34), '11': re.compile(r'eleven', flags=34), '12': re.compile(r'twelve', flags=34), '13': re.compile(r'thirteen', flags=34), '14': re.compile(r'fourteen', flags=34), '15': re.compile(r'fifteen', flags=34), '16': re.compile(r'sixteen', flags=34), '17': re.compile(r'seventeen', flags=34), '18': re.compile(r'eighteen', flags=34), '19': re.compile(r'nineteen', flags=34), '2': re.compile(r'two', flags=34), '20': re.compile(r'twenty', flags=34), '3': re.compile(r'three', flags=34), '4': re.compile(r'four', flags=34), '5': re.compile(r'five', flags=34), '6': re.compile(r'six', flags=34), '7': re.compile(r'seven', flags=34), '8': re.compile(r'eight', flags=34), '9': re.compile(r'nine', flags=34)}, ('SPN', 'XX'): {}, ('AMBRA', 'ES'): {}, ('AMBRA', 'DE'): {}, ('AMBRA', 'EN'): {}, ('AMBRA', 'XX'): {}, ('EURCOO', 'ES'): {}, ('EURCOO', 'DE'): {}, ('EURCOO', 'EN'): {}, ('EURCOO', 'XX'): {}, ('ROM', 'ES'): {}, ('ROM', 'DE'): {}, ('ROM', 'EN'): {}, ('ROM', 'XX'): {'1': re.compile(r'i', flags=34), '10': re.compile(r'x', flags=34), '11': re.compile(r'xi', flags=34), '12': re.compile(r'xii', flags=34), '13': re.compile(r'xiii', flags=34), '14': re.compile(r'xiv', flags=34), '15': re.compile(r'xv', flags=34), '16': re.compile(r'xvi', flags=34), '17': re.compile(r'xvii', flags=34), '18': re.compile(r'xviii', flags=34), '19': re.compile(r'xix', flags=34), '2': re.compile(r'ii', flags=34), '20': re.compile(r'xx', flags=34), '21': re.compile(r'xxi', flags=34), '22': re.compile(r'xxii', flags=34), '23': re.compile(r'xxiii', flags=34), '24': re.compile(r'xxiv', flags=34), '25': re.compile(r'xxv', flags=34), '26': re.compile(r'xxvi', flags=34), '27': re.compile(r'xxvii', flags=34), '28': re.compile(r'xxviii', flags=34), '29': re.compile(r'xxix', flags=34), '3': re.compile(r'iii', flags=34), '30': re.compile(r'xxx', flags=34), '31': re.compile(r'xxxi', flags=34), '32': re.compile(r'xxxii', flags=34), '33': re.compile(r'xxxiii', flags=34), '34': re.compile(r'xxxiv', flags=34), '35': re.compile(r'xxxv', flags=34), '36': re.compile(r'xxxvi', flags=34), '37': re.compile(r'xxxvii', flags=34), '38': re.compile(r'xxxviii', flags=34), '39': re.compile(r'xxxix', flags=34), '4': re.compile(r'iv', flags=34), '40': re.compile(r'xl', flags=34), '41': re.compile(r'xli', flags=34), '42': re.compile(r'xlii', flags=34), '43': re.compile(r'xliii', flags=34), '44': re.compile(r'xliv', flags=34), '45': re.compile(r'xlv', flags=34), '46': re.compile(r'xlvi', flags=34), '47': re.compile(r'xlvii', flags=34), '48': re.compile(r'xlviii', flags=34), '49': re.compile(r'xlix', flags=34), '5': re.compile(r'v', flags=34), '6': re.compile(r'vi', flags=34), '7': re.compile(r'vii', flags=34), '8': re.compile(r'viii', flags=34), '9': re.compile(r'ix', flags=34)}, ('LATIN', 'ES'): {}, ('LATIN', 'DE'): {}, ('LATIN', 'EN'): {}, ('LATIN', 'XX'): {'a': re.compile(r'bis', flags=34), 'aa': re.compile(r'bis\sbis', flags=34), 'ab': re.compile(r'bis\ster', flags=34), 'ac': re.compile(r'bis\squater', flags=34), 'ad': re.compile(r'bis\squinquies', flags=34), 'ae': re.compile(r'bis\ssexies', flags=34), 'af': re.compile(r'bis\ssepties', flags=34), 'ag': re.compile(r'bis\socties', flags=34), 'ah': re.compile(r'bis\snonies', flags=34), 'ai': re.compile(r'bis\sdecies', flags=34), 'aj': re.compile(r'bis\sundecies', flags=34), 'ak': re.compile(r'bis\sduodecies', flags=34), 'al': re.compile(r'bis\sterdecies', flags=34), 'am': re.compile(r'bis\squaterdecies', flags=34), 'an': re.compile(r'bis\squindecies', flags=34), 'ao': re.compile(r'bis\ssexdecies', flags=34), 'ap': re.compile(r'bis\sseptdecies', flags=34), 'aq': re.compile(r'bis\soctodecies', flags=34), 'ar': re.compile(r'bis\snovodecies', flags=34), 'as': re.compile(r'bis\svicies', flags=34), 'at': re.compile(r'bis\sunvicies', flags=34), 'au': re.compile(r'bis\sduovicies', flags=34), 'av': re.compile(r'bis\stervicies', flags=34), 'aw': re.compile(r'bis\squatervicies', flags=34), 'ax': re.compile(r'bis\squinvicies', flags=34), 'ay': re.compile(r'bis\ssexvicies', flags=34), 'az': re.compile(r'bis\sseptvicies', flags=34), 'b': re.compile(r'ter', flags=34), 'ba': re.compile(r'ter\sbis', flags=34), 'bb': re.compile(r'ter\ster', flags=34), 'bc': re.compile(r'ter\squater', flags=34), 'bd': re.compile(r'ter\squinquies', flags=34), 'be': re.compile(r'ter\ssexies', flags=34), 'bf': re.compile(r'ter\ssepties', flags=34), 'bg': re.compile(r'ter\socties', flags=34), 'bh': re.compile(r'ter\snonies', flags=34), 'bi': re.compile(r'ter\sdecies', flags=34), 'bj': re.compile(r'ter\sundecies', flags=34), 'bk': re.compile(r'ter\sduodecies', flags=34), 'bl': re.compile(r'ter\sterdecies', flags=34), 'bm': re.compile(r'ter\squaterdecies', flags=34), 'bn': re.compile(r'ter\squindecies', flags=34), 'bo': re.compile(r'ter\ssexdecies', flags=34), 'bp': re.compile(r'ter\sseptdecies', flags=34), 'c': re.compile(r'quater', flags=34), 'd': re.compile(r'quinquies', flags=34), 'e': re.compile(r'sexies', flags=34), 'f': re.compile(r'septies', flags=34), 'g': re.compile(r'octies', flags=34), 'h': re.compile(r'nonies', flags=34), 'i': re.compile(r'decies', flags=34), 'j': re.compile(r'undecies', flags=34), 'k': re.compile(r'duodecies', flags=34), 'l': re.compile(r'terdecies', flags=34), 'm': re.compile(r'quaterdecies', flags=34), 'n': re.compile(r'quindecies', flags=34), 'o': re.compile(r'sexdecies', flags=34), 'p': re.compile(r'septdecies', flags=34), 'q': re.compile(r'octodecies', flags=34), 'r': re.compile(r'novodecies', flags=34), 's': re.compile(r'vicies', flags=34), 't': re.compile(r'unvicies', flags=34), 'u': re.compile(r'duovicies', flags=34), 'v': re.compile(r'tervicies', flags=34), 'w': re.compile(r'quatervicies', flags=34), 'x': re.compile(r'quinvicies', flags=34), 'y': re.compile(r'sexvicies', flags=34), 'z': re.compile(r'septvicies', flags=34)}, ('NM', 'ES'): {}, ('NM', 'DE'): {}, ('NM', 'EN'): {}, ('NM', 'XX'): {}}[(tag, language)]

    @staticmethod
    def tag_2_group():
        return {'PT': 'axis', 'CHP': 'axis', 'PRT': 'axis', 'ANX': 'axis', 'REG': 'axis', 'SUBPAR': 'axis', 'DIR': 'axis', 'REC': 'axis', 'PRE': 'axis', 'ART': 'axis', 'SEC': 'axis', 'NUM': 'axis', 'SUB': 'axis', 'TRT': 'axis', 'FDC': 'axis', 'DEC': 'axis', 'TIT': 'axis', 'PG': 'axis', 'DIGIT': 'axis', 'PAR': 'axis', 'LTR': 'axis', 'PHR': 'axis', 'SPPLCR': 'connector', 'XPREVX': 'connector', 'LF': 'connector', 'THEREOF': 'connector', 'SPECIFIX': 'connector', 'SPCLPR': 'connector', 'AND': 'connector', 'OTHERX': 'connector', 'XDESUX': 'connector', 'BRCRPL': 'connector', 'SPECIALX': 'connector', 'COM': 'connector', 'RC': 'connector', 'SEPARATE': 'connector', '32007R0864': 'named_entity', '32011R1169': 'named_entity', '32006L0048': 'named_entity', '32009R1223': 'named_entity', '32015L2436': 'named_entity', '32010R1094': 'named_entity', '32019L0882': 'named_entity', '32009L0028': 'named_entity', '32001R2157': 'named_entity', '32014L0030': 'named_entity', '32006R0166': 'named_entity', '32009R0810': 'named_entity', '32015R2365': 'named_entity', '32014R0910': 'named_entity', '32004L0039': 'named_entity', '32003L0086': 'named_entity', '31985L0374': 'named_entity', '32017R2324': 'named_entity', '32019L0790': 'named_entity', '32014R0596': 'named_entity', '32012L0018': 'named_entity', 'TEU': 'named_entity', '32008R1272': 'named_entity', '32007R1393': 'named_entity', '32003L0035': 'named_entity', '32014R1286': 'named_entity', '32008R0440': 'named_entity', '32012R0650': 'named_entity', '32009L0125': 'named_entity', '31996L0071': 'named_entity', '32012R0648': 'named_entity', '32012R0531': 'named_entity', '32013R0606': 'named_entity', '32019L1937': 'named_entity', '32000L0060': 'named_entity', '32008L0115': 'named_entity', '32014R0806': 'named_entity', '32013R1024': 'named_entity', 'https://es.wikipedia.org/wiki/Tratado_Ant%C3%A1rtico': 'named_entity', '32004L0048': 'named_entity', '32011L0083': 'named_entity', '32009R1221': 'named_entity', '32011L0062': 'named_entity', '32001L0029': 'named_entity', '32015R0847': 'named_entity', '32010R1259': 'named_entity', '32019R0881': 'named_entity', '32018R1806': 'named_entity', '32017R0746': 'named_entity', '31987R2658': 'named_entity', '32016L0798': 'named_entity', '31992L0043': 'named_entity', '32009L0065': 'named_entity', '32013L0036': 'named_entity', '32017R1129': 'named_entity', '32014L0059': 'named_entity', '32006R1082': 'named_entity', '32013L0034': 'named_entity', '32014R0600': 'named_entity', '32001R0044': 'named_entity', '32017R0821': 'named_entity', '32002L0058': 'named_entity', '32019R2088': 'named_entity', '32006L0042': 'named_entity', '32016L0097': 'named_entity', '31990L0435': 'named_entity', '32007R0834': 'named_entity', '32008R0593': 'named_entity', '32003R2201': 'named_entity', '32006L0068': 'named_entity', '32006R1896': 'named_entity', '32007L0047': 'named_entity', '32018R0302': 'named_entity', '32013R0603': 'named_entity', '32013L0032': 'named_entity', '32006R1924': 'named_entity', '32019L1151': 'named_entity', '32000R1346': 'named_entity', '32013R0604': 'named_entity', '32007R0861': 'named_entity', '32013L0033': 'named_entity', '32000L0031': 'named_entity', '32017R1001': 'named_entity', '32000R2725': 'named_entity', '32004R0726': 'named_entity', '32008L0048': 'named_entity', '32016L0943': 'named_entity', '32007L0036': 'named_entity', '31994R2257': 'named_entity', '32018R0626': 'named_entity', '32016L1148': 'named_entity', '31993L0042': 'named_entity', '32009L0138': 'named_entity', '32012R0236': 'named_entity', '32015L2366': 'named_entity', '32014R0656': 'named_entity', '32004R0139': 'named_entity', '32003R1435': 'named_entity', '32006R1907': 'named_entity', '32003R0343': 'named_entity', '32012R1215': 'named_entity', '32014R0651': 'named_entity', '32007L0064': 'named_entity', '32016R0399': 'named_entity', '32018R0625': 'named_entity', '32014L0035': 'named_entity', '32006R1893': 'named_entity', '32018L2001': 'named_entity', '32010R0995': 'named_entity', '32014L0091': 'named_entity', '32011R0492': 'named_entity', '32015L0849': 'named_entity', '32004R0261': 'named_entity', '32011L0096': 'named_entity', '31985R2137': 'named_entity', '32011L0061': 'named_entity', '32010R1093': 'named_entity', '32006L0123': 'named_entity', 'TFEU': 'named_entity', '32017R0745': 'named_entity', '32014L0095': 'named_entity', '32016R0679': 'named_entity', '31962R0031': 'named_entity', '31999L0044': 'named_entity', '32011L0065': 'named_entity', '31993L0013': 'named_entity', '32001L0080': 'named_entity', '32002L0092': 'named_entity', '32010R1095': 'named_entity', '32016R1011': 'named_entity', '32018L1808': 'named_entity', 'CHAR': 'named_entity', '32014L0104': 'named_entity', 'TEEC': 'named_entity', '32014L0065': 'named_entity', '32002F0584': 'named_entity', '32003L0088': 'named_entity', '32003L0109': 'named_entity', '32006L0112': 'named_entity', '32009L0147': 'named_entity', 'https://en.wikipedia.org/wiki/Antarctic_Treaty_System': 'named_entity', '32014L0053': 'named_entity', '31995L0046': 'named_entity', '32016R0867': 'named_entity', 'https://de.wikipedia.org/wiki/Antarktis-Vertrag': 'named_entity', '32004R0805': 'named_entity', '32009R0004': 'named_entity', '32008R1333': 'named_entity', '32020R0852': 'named_entity', '32013R0575': 'named_entity', '32011L0095': 'named_entity', 'EUFCOO': 'value', 'SRNK': 'value', 'LATIN': 'value', 'SPN': 'value', 'AL': 'value', 'EURCOO': 'value', 'EULCOO': 'value', 'NM': 'value', 'ROM': 'value', 'AMBRA': 'value', 'NSTNM': 'value', 'AMBRA_L': 'value', 'AMBRA_L_B': 'value', 'AMBRA_L_BB': 'value', 'AMBRA_U': 'value', 'AMBRA_U_B': 'value', 'AMBRA_U_BB': 'value', 'ROM_L': 'value', 'ROM_L_B': 'value', 'ROM_L_BB': 'value', 'ROM_U': 'value', 'ROM_U_B': 'value', 'ROM_U_BB': 'value', 'AL_L': 'value', 'AL_L_B': 'value', 'AL_L_BB': 'value', 'AL_U': 'value', 'AL_U_B': 'value', 'AL_U_BB': 'value', 'NM_B': 'value', 'NM_BB': 'value'}

    @staticmethod
    def tag_2_pattern(language):
        return {'ES': {'EUFCOO': re.compile(r'\b(\b[0-9]{1,4}/[0-9]{1,4}/JAI\b)\b', flags=32), 'EULCOO': re.compile(r'(\b[0-9]{1,4}/[0-9]{1,4}/([UC]EE?|EURATOM)\b)', flags=34), 'EURCOO': re.compile(r'((\(([UC]EE?|Euratom)(,\s([UC]EE?|Euratom))*\)\s)?(№\s)?[0-9]{1,4}/[0-9]{1,4}\b)', flags=34), 'AMBRA_L': re.compile(r'\b([ivx])\b', flags=32), 'AMBRA_L_B': re.compile(r'\b([ivx])\)', flags=32), 'AMBRA_L_BB': re.compile(r'\(([ivx])\)', flags=32), 'AMBRA_U': re.compile(r'\b([IVX])\b', flags=32), 'AMBRA_U_B': re.compile(r'\b([IVX])\)', flags=32), 'AMBRA_U_BB': re.compile(r'\(([IVX])\)', flags=32), 'ROM_L': re.compile(r'\b(xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\b', flags=32), 'ROM_L_B': re.compile(r'\b(xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\)', flags=32), 'ROM_L_BB': re.compile(r'\((xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\)', flags=32), 'ROM_U': re.compile(r'\b(XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)[A-Ha-h]?\b', flags=32), 'ROM_U_B': re.compile(r'\b(XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)\)', flags=32), 'ROM_U_BB': re.compile(r'\((XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)\)', flags=32), 'AL_L': re.compile(r'\b([a-z])\b', flags=32), 'AL_L_B': re.compile(r'\b([a-z])\)', flags=32), 'AL_L_BB': re.compile(r'\(([a-z])\)', flags=32), 'AL_U': re.compile(r'\b([A-Z])\b', flags=32), 'AL_U_B': re.compile(r'\b([A-Z])\)', flags=32), 'AL_U_BB': re.compile(r'\(([A-Z])\)', flags=32), 'NM': re.compile(r'\b([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\b', flags=32), 'NM_B': re.compile(r'\b([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\)', flags=32), 'NM_BB': re.compile(r'\(([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\)', flags=32), 'LATIN': re.compile(r'\b(septvicies|ter\sterdecies|quinvicies|duodecies|sexvicies|ter|ter\sdecies|bis\ssexvicies|bis|bis\socties|bis\soctodecies|bis\ster|bis\stervicies|ter\ssexdecies|unvicies|ter\snonies|bis\squatervicies|novodecies|terdecies|ter\squaterdecies|ter\squinquies|bis\snonies|ter\sseptdecies|duovicies|quatervicies|septdecies|bis\sdecies|bis\svicies|ter\sundecies|nonies|ter\socties|ter\sduodecies|ter\squindecies|ter\ssepties|octodecies|bis\sundecies|bis\sunvicies|ter\squater|ter\sbis|ter\ster|ter\ssexies|undecies|bis\ssexdecies|bis\squinvicies|decies|bis\squindecies|septies|tervicies|octies|bis\sterdecies|bis\sbis|bis\sduodecies|bis\ssepties|bis\ssexies|bis\sseptvicies|sexies|bis\squaterdecies|bis\snovodecies|quater|vicies|bis\sduovicies|quinquies|bis\squater|bis\sseptdecies|sexdecies|quindecies|quaterdecies|bis\squinquies)\b', flags=32), 'SRNK': re.compile(r'\b(decimonoven[oa]|decimotercer[oa]|décim[oa]|decimocuart[oa]|decimoséptim[oa]|octav[oa]|undécim[oa]|noven[oa]|sext[oa]|decimosext[oa]|decimoquint[oa]|séptim[oa]|quint[oa]|cuart[oa]|segund[oa]|duodécim[oa]|tercer[oa]|primer[oa]|decimooctav[oa]|vijésim[oa])\b', flags=34), 'SPN': re.compile(r'\b(cinco|cuatro|once|diecisiete|quince|diecinueve|ocho|dos|tres|seis|uno|trece|doce|diez|quatorce|dieciocho|siete|veinte|nueve|dieciseis)\b', flags=34), 'NSTNM': re.compile(r'\b([0-9]+(\.[0-9]+)+)\b', flags=32)}, 'DE': {'EUFCOO': re.compile(r'\b(\b[0-9]{1,4}/[0-9]{1,4}/JI\b)\b', flags=32), 'EULCOO': re.compile(r'(\b(Nr.\s)?[0-9]{1,4}/[0-9]{1,4}/(E[UGWC]G?|EURATOM)\b)', flags=34), 'EURCOO': re.compile(r'((\((E[UGWC]G?|Euratom)(,\s(E[UGWC]G?|Euratom))*\)\s)?(Nr.\s)?[0-9]{1,4}/[0-9]{1,4}\b)', flags=34), 'AMBRA_L': re.compile(r'\b([ivx])\b', flags=32), 'AMBRA_L_B': re.compile(r'\b([ivx])\)', flags=32), 'AMBRA_L_BB': re.compile(r'\(([ivx])\)', flags=32), 'AMBRA_U': re.compile(r'\b([IVX])\b', flags=32), 'AMBRA_U_B': re.compile(r'\b([IVX])\)', flags=32), 'AMBRA_U_BB': re.compile(r'\(([IVX])\)', flags=32), 'ROM_L': re.compile(r'\b(xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\b', flags=32), 'ROM_L_B': re.compile(r'\b(xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\)', flags=32), 'ROM_L_BB': re.compile(r'\((xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\)', flags=32), 'ROM_U': re.compile(r'\b(XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)[A-Ha-h]?\b', flags=32), 'ROM_U_B': re.compile(r'\b(XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)\)', flags=32), 'ROM_U_BB': re.compile(r'\((XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)\)', flags=32), 'AL_L': re.compile(r'\b([a-z])\b', flags=32), 'AL_L_B': re.compile(r'\b([a-z])\)', flags=32), 'AL_L_BB': re.compile(r'\(([a-z])\)', flags=32), 'AL_U': re.compile(r'\b([A-Z])\b', flags=32), 'AL_U_B': re.compile(r'\b([A-Z])\)', flags=32), 'AL_U_BB': re.compile(r'\(([A-Z])\)', flags=32), 'NM': re.compile(r'\b([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\b', flags=32), 'NM_B': re.compile(r'\b([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\)', flags=32), 'NM_BB': re.compile(r'\(([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\)', flags=32), 'LATIN': re.compile(r'\b(septvicies|ter\sterdecies|quinvicies|duodecies|sexvicies|ter|ter\sdecies|bis\ssexvicies|bis|bis\socties|bis\soctodecies|bis\ster|bis\stervicies|ter\ssexdecies|unvicies|ter\snonies|bis\squatervicies|novodecies|terdecies|ter\squaterdecies|ter\squinquies|bis\snonies|ter\sseptdecies|duovicies|quatervicies|septdecies|bis\sdecies|bis\svicies|ter\sundecies|nonies|ter\socties|ter\sduodecies|ter\squindecies|ter\ssepties|octodecies|bis\sundecies|bis\sunvicies|ter\squater|ter\sbis|ter\ster|ter\ssexies|undecies|bis\ssexdecies|bis\squinvicies|decies|bis\squindecies|septies|tervicies|octies|bis\sterdecies|bis\sbis|bis\sduodecies|bis\ssepties|bis\ssexies|bis\sseptvicies|sexies|bis\squaterdecies|bis\snovodecies|quater|vicies|bis\sduovicies|quinquies|bis\squater|bis\sseptdecies|sexdecies|quindecies|quaterdecies|bis\squinquies)\b', flags=32), 'SRNK': re.compile(r'\b(dritte[rsnm]?|achte[rsnm]?|vierzehnte[rsnm]?|elfte[rsnm]?|achtzehnte[rsnm]?|sechzehnte[rsnm]?|zehnte[rsnm]?|zwanzigste[rsnm]?|dreizehnte[rsnm]?|fünfte[rsnm]?|neunte[rsnm]?|zwölfte[rsnm]?|vierte[rsnm]?|erste[rsnm]?|sechste[rsnm]?|fünfzehnte[rsnm]?|siebte[rsnm]?|siebzehnte[rsnm]?|neunzehnte[rsnm]?|zweite[rsnm]?)\b', flags=34), 'SPN': re.compile(r'\b(achtzehn|zehn|dreizehn|drei|zwanzig|neun|zwölf|sechs|sechzehn|neunzehn|sieben|siebzehn|elf|fünfzehn|acht|vierzehn|vier|eins|zwei|fünf)\b', flags=34), 'NSTNM': re.compile(r'\b([0-9]+(\.[0-9]+)+)\b', flags=32)}, 'EN': {'EUFCOO': re.compile(r'\b(\b[0-9]{1,4}/[0-9]{1,4}/JHA\b)\b', flags=32), 'EULCOO': re.compile(r'(\b[0-9]{1,4}/[0-9]{1,4}/(EU|EC|EEC|ECSC|EURATOM)\b)', flags=34), 'EURCOO': re.compile(r'((\((EU|EC|EEC|ECSC|EURATOM)(,\s(EU|EC|EEC|ECSC|EURATOM))*\)\s)?(No\s)?[0-9]{1,4}/[0-9]{1,4}\b)', flags=34), 'AMBRA_L': re.compile(r'\b([ivx])\b', flags=32), 'AMBRA_L_B': re.compile(r'\b([ivx])\)', flags=32), 'AMBRA_L_BB': re.compile(r'\(([ivx])\)', flags=32), 'AMBRA_U': re.compile(r'\b([IVX])\b', flags=32), 'AMBRA_U_B': re.compile(r'\b([IVX])\)', flags=32), 'AMBRA_U_BB': re.compile(r'\(([IVX])\)', flags=32), 'ROM_L': re.compile(r'\b(xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\b', flags=32), 'ROM_L_B': re.compile(r'\b(xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\)', flags=32), 'ROM_L_BB': re.compile(r'\((xx|vi|xxii|xliv|xxxiii|xiii|xviii|v|xlviii|xxiii|x|xxxv|xxxix|xxxii|xxxvii|xxvi|xxxviii|vii|xxvii|xxiv|xv|xliii|xxxiv|xlix|iv|xxx|xxix|xiv|xvi|xxi|xl|iii|xxxvi|xli|xlvi|i|xii|viii|xlv|xvii|ii|xix|xxxi|xxviii|ix|xi|xlii|xlvii|xxv)\)', flags=32), 'ROM_U': re.compile(r'\b(XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)[A-Ha-h]?\b', flags=32), 'ROM_U_B': re.compile(r'\b(XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)\)', flags=32), 'ROM_U_BB': re.compile(r'\((XX|VI|XXII|XLIV|XXXIII|XIII|XVIII|V|XLVIII|XXIII|X|XXXV|XXXIX|XXXII|XXXVII|XXVI|XXXVIII|VII|XXVII|XXIV|XV|XLIII|XXXIV|XLIX|IV|XXX|XXIX|XIV|XVI|XXI|XL|III|XXXVI|XLI|XLVI|I|XII|VIII|XLV|XVII|II|XIX|XXXI|XXVIII|IX|XI|XLII|XLVII|XXV)\)', flags=32), 'AL_L': re.compile(r'\b([a-z])\b', flags=32), 'AL_L_B': re.compile(r'\b([a-z])\)', flags=32), 'AL_L_BB': re.compile(r'\(([a-z])\)', flags=32), 'AL_U': re.compile(r'\b([A-Z])\b', flags=32), 'AL_U_B': re.compile(r'\b([A-Z])\)', flags=32), 'AL_U_BB': re.compile(r'\(([A-Z])\)', flags=32), 'NM': re.compile(r'\b([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\b', flags=32), 'NM_B': re.compile(r'\b([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\)', flags=32), 'NM_BB': re.compile(r'\(([1-9][0-9]*[a-zA-Z]{0,2}(?!\s*%))\)', flags=32), 'LATIN': re.compile(r'\b(septvicies|ter\sterdecies|quinvicies|duodecies|sexvicies|ter|ter\sdecies|bis\ssexvicies|bis|bis\socties|bis\soctodecies|bis\ster|bis\stervicies|ter\ssexdecies|unvicies|ter\snonies|bis\squatervicies|novodecies|terdecies|ter\squaterdecies|ter\squinquies|bis\snonies|ter\sseptdecies|duovicies|quatervicies|septdecies|bis\sdecies|bis\svicies|ter\sundecies|nonies|ter\socties|ter\sduodecies|ter\squindecies|ter\ssepties|octodecies|bis\sundecies|bis\sunvicies|ter\squater|ter\sbis|ter\ster|ter\ssexies|undecies|bis\ssexdecies|bis\squinvicies|decies|bis\squindecies|septies|tervicies|octies|bis\sterdecies|bis\sbis|bis\sduodecies|bis\ssepties|bis\ssexies|bis\sseptvicies|sexies|bis\squaterdecies|bis\snovodecies|quater|vicies|bis\sduovicies|quinquies|bis\squater|bis\sseptdecies|sexdecies|quindecies|quaterdecies|bis\squinquies)\b', flags=32), 'SRNK': re.compile(r'\b(fifteenth|eleventh|second|thirteenth|fourteenth|eighth|twelth|first|fifth|seventh|tenth|fourth|third|sixteenth|sixth|twentieth|ninth|nineteenth|eighteenth|seventeenth)\b', flags=34), 'SPN': re.compile(r'\b(thirteen|twenty|eight|four|sixteen|ten|six|three|fourteen|eighteen|two|nine|seven|one|five|nineteen|fifteen|twelve|eleven|seventeen)\b', flags=34), 'NSTNM': re.compile(r'\b([0-9]+(\.[0-9]+)+)\b', flags=32)}}[language]


class ValuePattern:
    __tablename__ = 'value_pattern'


class NamedEntity:
    __tablename__ = 'named_entity'

    @staticmethod
    def key_pattern(language, only_treaties=False) -> List[Tuple[str, Pattern]]:
        return {('ES', True): [('TEU', re.compile('\\b(Tratado de la Unión Europea)\\b', re.IGNORECASE)), ('TEU', re.compile('\\b(TUE)\\b'))], ('ES', False): [('https://es.wikipedia.org/wiki/Tratado_Ant%C3%A1rtico', re.compile('\\b(Tratado Antártico)\\b', re.IGNORECASE)), ('TEU', re.compile('\\b(Tratado de la Unión Europea)\\b', re.IGNORECASE)), ('TEU', re.compile('\\b(TUE)\\b')), ('32016R0679', re.compile('\\b(Reglamento General de Protección de Datos)\\b', re.IGNORECASE)), ('32016R0679', re.compile('\\b(RGPD)\\b')), ('31985R2137', re.compile('\\b(AEIE)\\b', re.IGNORECASE)), ('31985R2137', re.compile('\\b(AEIE)\\b')), ('32000L0031', re.compile('\\b(Directiva sobre el comercio electrónico)\\b', re.IGNORECASE)), ('32000L0060', re.compile('\\b(DMA)\\b', re.IGNORECASE)), ('32000L0060', re.compile('\\b(DMA)\\b')), ('32001R2157', re.compile('\\b(SE)\\b', re.IGNORECASE)), ('32001R2157', re.compile('\\b(SE)\\b')), ('32002F0584', re.compile('\\b(ODE)\\b', re.IGNORECASE)), ('32002F0584', re.compile('\\b(ODE)\\b')), ('32002L0058', re.compile('\\b(Directiva sobre la privacidad y las comunicaciones electrónicas)\\b', re.IGNORECASE)), ('32003R1435', re.compile('\\b(SCE)\\b', re.IGNORECASE)), ('32003R1435', re.compile('\\b(SCE)\\b')), ('32004R0139', re.compile('\\b(Reglamento comunitario de concentraciones)\\b', re.IGNORECASE)), ('32006R1082', re.compile('\\b(AECT)\\b', re.IGNORECASE)), ('32006R1082', re.compile('\\b(AECT)\\b')), ('32006R1907', re.compile('\\b(REACH)\\b', re.IGNORECASE)), ('32006R1907', re.compile('\\b(REACH)\\b')), ('32007R0864', re.compile('\\b(Roma II)\\b', re.IGNORECASE)), ('32007R0864', re.compile('\\b(Roma II)\\b')), ('32007R1393', re.compile('\\b(notificación y traslado de documentos)\\b', re.IGNORECASE)), ('32008R0593', re.compile('\\b(Roma I)\\b', re.IGNORECASE)), ('32008R0593', re.compile('\\b(Roma I)\\b')), ('32009L0065', re.compile('\\b(OICVM)\\b', re.IGNORECASE)), ('32009L0065', re.compile('\\b(OICVM)\\b')), ('32009L0138', re.compile('\\b(Solvencia II)\\b', re.IGNORECASE)), ('32009R0810', re.compile('\\b(Código de visados)\\b', re.IGNORECASE)), ('32009R1221', re.compile('\\b(EMAS)\\b', re.IGNORECASE)), ('32009R1221', re.compile('\\b(EMAS)\\b')), ('32010R1093', re.compile('\\b(EBA)\\b', re.IGNORECASE)), ('32010R1093', re.compile('\\b(EBA)\\b')), ('32010R1094', re.compile('\\b(Autoridad Europea de Seguros y Pensiones de Jubilación)\\b', re.IGNORECASE)), ('32010R1095', re.compile('\\b(Autoridad Europea de Valores y Mercados)\\b', re.IGNORECASE)), ('32014L0091', re.compile('\\b(OICVM)\\b', re.IGNORECASE)), ('32014L0091', re.compile('\\b(OICVM)\\b')), ('32014R0596', re.compile('\\b(Reglamento sobre abuso de mercado)\\b', re.IGNORECASE)), ('32016L0943', re.compile('\\b(secretos comerciales)\\b', re.IGNORECASE)), ('32016R0399', re.compile('\\b(Código de fronteras Schengen)\\b', re.IGNORECASE)), ('32018L1808', re.compile('\\b(Directiva de servicios de comunicación audiovisual)\\b', re.IGNORECASE)), ('32019L0882', re.compile('\\b(Acta Europea de Accesibilidad)\\b', re.IGNORECASE))], ('DE', True): [('TFEU', re.compile('\\b(Vertrags? über die (Arbeitsweise|Funktionsweise) der Europäischen Union)\\b', re.IGNORECASE)), ('TFEU', re.compile('\\b(AEUV)\\b')), ('CHAR', re.compile('\\b(Charta( der Grundrechte der Europäischen Union)?)\\b', re.IGNORECASE)), ('CHAR', re.compile('\\b(Charta)\\b')), ('TEU', re.compile('\\b(Vertrags? über die Europäische Union|EU-Vertrags?)\\b', re.IGNORECASE)), ('TEU', re.compile('\\b(EUV)\\b')), ('TEEC', re.compile('\\b(Vertrags? zur Gründung der Europäischen Gemeinschaft)\\b', re.IGNORECASE)), ('TEEC', re.compile('\\b(EGV)\\b'))], ('DE', False): [('https://de.wikipedia.org/wiki/Antarktis-Vertrag', re.compile('\\b(Antarktis-Vertrags?)\\b', re.IGNORECASE)), ('TFEU', re.compile('\\b(Vertrags? über die (Arbeitsweise|Funktionsweise) der Europäischen Union)\\b', re.IGNORECASE)), ('TFEU', re.compile('\\b(AEUV)\\b')), ('CHAR', re.compile('\\b(Charta( der Grundrechte der Europäischen Union)?)\\b', re.IGNORECASE)), ('CHAR', re.compile('\\b(Charta)\\b')), ('TEU', re.compile('\\b(Vertrags? über die Europäische Union|EU-Vertrags?)\\b', re.IGNORECASE)), ('TEU', re.compile('\\b(EUV)\\b')), ('TEEC', re.compile('\\b(Vertrags? zur Gründung der Europäischen Gemeinschaft)\\b', re.IGNORECASE)), ('TEEC', re.compile('\\b(EGV)\\b')), ('32009L0138', re.compile('\\b(Solvabilität II)\\b', re.IGNORECASE)), ('32009L0138', re.compile('\\b(Solvabilität II)\\b')), ('31985R2137', re.compile('\\b(Europäische wirtschaftliche Interessenvereinigung)\\b', re.IGNORECASE)), ('31985R2137', re.compile('\\b(EWIV)\\b')), ('32001L0029', re.compile('\\b(Urheberrechtsrichtlinie)\\b', re.IGNORECASE)), ('32001R0044', re.compile('\\b(Brüssel-I-Verordnung)\\b', re.IGNORECASE)), ('32001R0044', re.compile('\\b(EuGVVO)\\b')), ('32001R2157', re.compile('\\b(Europäische Gesellschaft)\\b', re.IGNORECASE)), ('32001R2157', re.compile('\\b(SE)\\b')), ('32002F0584', re.compile('\\b(Europäischer Haftbefehl)\\b', re.IGNORECASE)), ('32002F0584', re.compile('\\b(EuHB)\\b')), ('32003R1435', re.compile('\\b(Europäische Genossenschaft)\\b', re.IGNORECASE)), ('32003R1435', re.compile('\\b(SCE)\\b')), ('32003R2201', re.compile('\\b(Brüssel IIa)\\b', re.IGNORECASE)), ('32003R2201', re.compile('\\b(Brüssel IIa)\\b')), ('32004L0039', re.compile('\\b(Finanzmarktrichtlinie I)\\b', re.IGNORECASE)), ('32004L0039', re.compile('\\b(MiFID I)\\b')), ('32004L0048', re.compile('\\b(Durchsetzungsrichtlinie)\\b', re.IGNORECASE)), ('32004L0048', re.compile('\\b(IPRED)\\b')), ('32004R0139', re.compile('\\b(EG-Fusionskontrollverordnung)\\b', re.IGNORECASE)), ('32004R0139', re.compile('\\b(FKVO)\\b')), ('32006L0048', re.compile('\\b(Tätigkeit der Kreditinstitute)\\b', re.IGNORECASE)), ('32006L0048', re.compile('\\b(CRD)\\b')), ('32006L0112', re.compile('\\b(Mehrwertsteuer)\\b', re.IGNORECASE)), ('32006R0166', re.compile('\\b(Schadstofffreisetzungs- und -verbringungsregister)\\b', re.IGNORECASE)), ('32006R1082', re.compile('\\b(Europäischer Verbund für territoriale Zusammenarbeit)\\b', re.IGNORECASE)), ('32006R1082', re.compile('\\b(EVTZ)\\b')), ('32006R1896', re.compile('\\b(Europäisches Mahnverfahren)\\b', re.IGNORECASE)), ('32006R1907', re.compile('\\b(REACH)\\b', re.IGNORECASE)), ('32006R1907', re.compile('\\b(REACH)\\b')), ('32007R0861', re.compile('\\b(Verfahren für geringfügige Forderungen)\\b', re.IGNORECASE)), ('32007R0864', re.compile('\\b(Rom II)\\b', re.IGNORECASE)), ('32007R0864', re.compile('\\b(Rom II)\\b')), ('32007R1393', re.compile('\\b(Zustellung von Schriftstücken)\\b', re.IGNORECASE)), ('32008R0593', re.compile('\\b(Rom I)\\b', re.IGNORECASE)), ('32008R0593', re.compile('\\b(Rom I)\\b')), ('32009L0065', re.compile('\\b(Organismen für gemeinsame Anlagen in Wertpapieren)\\b', re.IGNORECASE)), ('32009L0065', re.compile('\\b(OGAW)\\b')), ('32010R1259', re.compile('\\b(Rom III)\\b', re.IGNORECASE)), ('32010R1259', re.compile('\\b(Rom III)\\b')), ('32011R1169', re.compile('\\b(Lebensmittel-Informationsverordnung)\\b', re.IGNORECASE)), ('32011R1169', re.compile('\\b(LMIV)\\b')), ('32012R0648', re.compile('\\b(Regulierung des außerbörslichen Derivatehandels)\\b', re.IGNORECASE)), ('32012R0648', re.compile('\\b(EMIR)\\b')), ('32012R0650', re.compile('\\b(Rom IV)\\b', re.IGNORECASE)), ('32012R0650', re.compile('\\b(Rom IV)\\b')), ('32012R1215', re.compile('\\b(EuGVVO)\\b', re.IGNORECASE)), ('32012R1215', re.compile('\\b(EuGVVO)\\b')), ('32013L0034', re.compile('\\b(Bilanz-Richtlinie)\\b', re.IGNORECASE)), ('32013L0034', re.compile('\\b(IFRS)\\b')), ('32013L0036', re.compile('\\b(Kapitaladäquanzrichtlinie)\\b', re.IGNORECASE)), ('32013L0036', re.compile('\\b(CRD)\\b')), ('32013R0575', re.compile('\\b(Kapitaladäquanzverordnung)\\b', re.IGNORECASE)), ('32013R0575', re.compile('\\b(CRR)\\b')), ('32014L0065', re.compile('\\b(Finanzmarktrichtlinie II)\\b', re.IGNORECASE)), ('32014L0065', re.compile('\\b(MiFID II)\\b')), ('32014R0910', re.compile('\\b(eIDAS)\\b', re.IGNORECASE)), ('32014R0910', re.compile('\\b(eIDAS)\\b')), ('32015L2366', re.compile('\\b(Zahlungsdiensterichtlinie)\\b', re.IGNORECASE)), ('32015L2366', re.compile('\\b(PSD2)\\b')), ('32016R0679', re.compile('\\b(Datenschutzgrundverordnung)\\b', re.IGNORECASE)), ('32016R0679', re.compile('\\b(DSGVO)\\b')), ('32006L0068', re.compile('\\b(Kapitalgesellschaftsrichtlinie)\\b', re.IGNORECASE)), ('32007L0036', re.compile('\\b(Aktionärsrechterichtlinie)\\b', re.IGNORECASE)), ('32003L0035', re.compile('\\b(Öffentlichkeitsbeteiligungsrichtlinie)\\b', re.IGNORECASE)), ('32008L0048', re.compile('\\b(Verbraucherkreditrichtlinie)\\b', re.IGNORECASE)), ('32018L1808', re.compile('\\b(Richtlinie über audiovisuelle Mediendienste)\\b', re.IGNORECASE)), ('31985L0374', re.compile('\\b(Produkthaftungsrichtlinie)\\b', re.IGNORECASE)), ('31987R2658', re.compile('\\b(Kombinierte Nomenklatur)\\b', re.IGNORECASE)), ('31990L0435', re.compile('\\b(Mutter-Tochter-Richtlinie)\\b', re.IGNORECASE)), ('31992L0043', re.compile('\\b(FFH)\\b', re.IGNORECASE)), ('31992L0043', re.compile('\\b(FFH)\\b')), ('31994R2257', re.compile('\\b(Bananenverordnung)\\b', re.IGNORECASE)), ('31995L0046', re.compile('\\b(Datenschutzrichtlinie)\\b', re.IGNORECASE)), ('31996L0071', re.compile('\\b(Entsenderichtlinie)\\b', re.IGNORECASE)), ('32000L0031', re.compile('\\b(eCommerce Richtlinie)\\b', re.IGNORECASE)), ('32000L0060', re.compile('\\b(EU-WRRL)\\b', re.IGNORECASE)), ('32000L0060', re.compile('\\b(EU-WRRL)\\b')), ('32000R1346', re.compile('\\b(Insolvenzverordnung)\\b', re.IGNORECASE)), ('32002L0058', re.compile('\\b(ePrivacy-Richtlinie)\\b', re.IGNORECASE)), ('32003L0088', re.compile('\\b(Arbeitszeitrichtlinie)\\b', re.IGNORECASE)), ('32003L0109', re.compile('\\b(Daueraufenthaltsrichtlinie)\\b', re.IGNORECASE)), ('32003R0343', re.compile('\\b(Dublin II)\\b', re.IGNORECASE)), ('32004R0261', re.compile('\\b(Fluggastrechte-Verordnung)\\b', re.IGNORECASE)), ('32004R0726', re.compile('\\b(EMA)\\b', re.IGNORECASE)), ('32004R0726', re.compile('\\b(EMA)\\b')), ('32004R0805', re.compile('\\b(EG-Vollstr-Titel)\\b', re.IGNORECASE)), ('32004R0805', re.compile('\\b(EG-Vollstr-Titel)\\b')), ('32006L0042', re.compile('\\b(Maschinenrichtlinie)\\b', re.IGNORECASE)), ('32006L0123', re.compile('\\b(Dienstleistungsrichtlinie)\\b', re.IGNORECASE)), ('32006R1893', re.compile('\\b(NACE)\\b', re.IGNORECASE)), ('32006R1893', re.compile('\\b(NACE)\\b')), ('32007R0834', re.compile('\\b(EG-Öko-Basisverordnung)\\b', re.IGNORECASE)), ('32008L0115', re.compile('\\b(Rückführungsrichtlinie)\\b', re.IGNORECASE)), ('32008R1272', re.compile('\\b(GHS)\\b', re.IGNORECASE)), ('32008R1272', re.compile('\\b(GHS)\\b')), ('32009L0028', re.compile('\\b(RED)\\b', re.IGNORECASE)), ('32009L0028', re.compile('\\b(RED)\\b')), ('32009L0125', re.compile('\\b(ErP)\\b', re.IGNORECASE)), ('32009L0125', re.compile('\\b(ErP)\\b')), ('32009L0147', re.compile('\\b(Vogelschutzrichtlinie)\\b', re.IGNORECASE)), ('32009R0004', re.compile('\\b(EG-UnterhaltsS)\\b', re.IGNORECASE)), ('32009R0004', re.compile('\\b(EG-UnterhaltsS)\\b')), ('32009R0810', re.compile('\\b(Visakodex)\\b', re.IGNORECASE)), ('32009R1223', re.compile('\\b(Kosmetikverordnung)\\b', re.IGNORECASE)), ('32010R0995', re.compile('\\b(EUTR)\\b', re.IGNORECASE)), ('32010R0995', re.compile('\\b(EUTR)\\b')), ('32010R1093', re.compile('\\b(EBA)\\b', re.IGNORECASE)), ('32010R1093', re.compile('\\b(EBA)\\b')), ('32010R1094', re.compile('\\b(EIOPA)\\b', re.IGNORECASE)), ('32010R1094', re.compile('\\b(EIOPA)\\b')), ('32010R1095', re.compile('\\b(ESMA)\\b', re.IGNORECASE)), ('32010R1095', re.compile('\\b(ESMA)\\b')), ('32011L0061', re.compile('\\b(AIFM)\\b', re.IGNORECASE)), ('32011L0061', re.compile('\\b(AIFM)\\b')), ('32011L0062', re.compile('\\b(Arzneimittelfälschungen)\\b', re.IGNORECASE)), ('32011L0083', re.compile('\\b(Verbraucherrechte)\\b', re.IGNORECASE)), ('32011L0095', re.compile('\\b(Qualifikationsrichtlinie)\\b', re.IGNORECASE)), ('32011R0492', re.compile('\\b(AN-Freizüg)\\b', re.IGNORECASE)), ('32011R0492', re.compile('\\b(AN-Freizüg)\\b')), ('32012L0018', re.compile('\\b(Seveso III)\\b', re.IGNORECASE)), ('32012L0018', re.compile('\\b(Seveso III)\\b')), ('32012R0531', re.compile('\\b(Eurotariff)\\b', re.IGNORECASE)), ('32012R0531', re.compile('\\b(Eurotariff)\\b')), ('32013L0032', re.compile('\\b(Asylverfahrensrichtlinie)\\b', re.IGNORECASE)), ('32013L0033', re.compile('\\b(Aufnahmerichtlinie)\\b', re.IGNORECASE)), ('32013R0603', re.compile('\\b(Eurodac)\\b', re.IGNORECASE)), ('32013R0603', re.compile('\\b(Eurodac)\\b')), ('32013R0604', re.compile('\\b(Dublin III)\\b', re.IGNORECASE)), ('32013R0606', re.compile('\\b(Schutzmaßnahmen VO)\\b', re.IGNORECASE)), ('32013R1024', re.compile('\\b(SSM)\\b', re.IGNORECASE)), ('32013R1024', re.compile('\\b(SSM)\\b')), ('32014L0030', re.compile('\\b(EMV)\\b', re.IGNORECASE)), ('32014L0030', re.compile('\\b(EMV)\\b')), ('32014L0035', re.compile('\\b(Niederspannungsrichtlinie)\\b', re.IGNORECASE)), ('32014L0053', re.compile('\\b(RED)\\b', re.IGNORECASE)), ('32014L0053', re.compile('\\b(RED)\\b')), ('32014L0059', re.compile('\\b(BRRD)\\b', re.IGNORECASE)), ('32014L0059', re.compile('\\b(BRRD)\\b')), ('32014L0091', re.compile('\\b(OGAW)\\b', re.IGNORECASE)), ('32014L0091', re.compile('\\b(OGAW)\\b')), ('32014R0600', re.compile('\\b(MiFIR)\\b', re.IGNORECASE)), ('32014R0600', re.compile('\\b(MiFIR)\\b')), ('32014R0651', re.compile('\\b(GBER)\\b', re.IGNORECASE)), ('32014R0651', re.compile('\\b(GBER)\\b')), ('32014R0656', re.compile('\\b(Seeaußengrenzenverordnung)\\b', re.IGNORECASE)), ('32014R0806', re.compile('\\b(SRM)\\b', re.IGNORECASE)), ('32014R0806', re.compile('\\b(SRM)\\b')), ('32014R1286', re.compile('\\b(PRIIP)\\b', re.IGNORECASE)), ('32014R1286', re.compile('\\b(PRIIP)\\b')), ('32015L0849', re.compile('\\b(AMLD 4)\\b', re.IGNORECASE)), ('32015L0849', re.compile('\\b(AMLD 4)\\b')), ('32015L2436', re.compile('\\b(MarkenRL)\\b', re.IGNORECASE)), ('32015L2436', re.compile('\\b(MarkenRL)\\b')), ('32015R0847', re.compile('\\b(Geldtransferverordnung)\\b', re.IGNORECASE)), ('32016L0943', re.compile('\\b(KnowHowRL)\\b', re.IGNORECASE)), ('32016L0943', re.compile('\\b(KnowHowRL)\\b')), ('32016R0399', re.compile('\\b(SGK)\\b', re.IGNORECASE)), ('32016R0399', re.compile('\\b(SGK)\\b')), ('32016R1011', re.compile('\\b(EU Referenzwerte-Verordnung)\\b', re.IGNORECASE)), ('32017R0745', re.compile('\\b(MDR)\\b', re.IGNORECASE)), ('32017R0745', re.compile('\\b(MDR)\\b')), ('32017R0746', re.compile('\\b(IVD)\\b', re.IGNORECASE)), ('32017R0746', re.compile('\\b(IVD)\\b')), ('32017R1001', re.compile('\\b(UMV)\\b', re.IGNORECASE)), ('32017R1001', re.compile('\\b(UMV)\\b')), ('32017R1129', re.compile('\\b(Prospektverordnung)\\b', re.IGNORECASE)), ('32017R2324', re.compile('\\b(Glyphosatverordnung)\\b', re.IGNORECASE)), ('32018L2001', re.compile('\\b(RED II)\\b', re.IGNORECASE)), ('32018L2001', re.compile('\\b(RED II)\\b')), ('32018R0302', re.compile('\\b(Geoblocking-VO)\\b', re.IGNORECASE)), ('32018R0302', re.compile('\\b(Geoblocking-VO)\\b')), ('32018R0625', re.compile('\\b(DVUM)\\b', re.IGNORECASE)), ('32018R0625', re.compile('\\b(DVUM)\\b')), ('32018R0626', re.compile('\\b(UMDV)\\b', re.IGNORECASE)), ('32018R0626', re.compile('\\b(UMDV)\\b')), ('32018R1806', re.compile('\\b(EU-Visum VO)\\b', re.IGNORECASE)), ('32019L0790', re.compile('\\b(Urheberrechtsrichtlinie)\\b', re.IGNORECASE)), ('32019L0882', re.compile('\\b(Europäischer Rechtsakt zur Barrierefreiheit)\\b', re.IGNORECASE)), ('32019L1151', re.compile('\\b(Digitalisierungsrichtlinie)\\b', re.IGNORECASE)), ('32019R0881', re.compile('\\b(ENISA)\\b', re.IGNORECASE)), ('32019R0881', re.compile('\\b(ENISA)\\b')), ('32020R0852', re.compile('\\b(Taxonomie-Verordnung)\\b', re.IGNORECASE)), ('32019R2088', re.compile('\\b(Offenlegungsverordnung)\\b')), ('32019L1937', re.compile('\\b(WBRL)\\b', re.IGNORECASE)), ('32019L1937', re.compile('\\b(Whistleblower-Richtlinie)\\b'))], ('EN', True): [('TFEU', re.compile('\\b(Treaty on the Functioning of the European Union)\\b', re.IGNORECASE)), ('TFEU', re.compile('\\b(TFEU)\\b')), ('TEU', re.compile('\\b(Treaty on European Union)\\b', re.IGNORECASE)), ('TEU', re.compile('\\b(TEU)\\b')), ('TEEC', re.compile('\\b(Treaty establishing the European( Economic)? Community)\\b', re.IGNORECASE))], ('EN', False): [('https://en.wikipedia.org/wiki/Antarctic_Treaty_System', re.compile('\\b(Antarctic Treaty)\\b', re.IGNORECASE)), ('TFEU', re.compile('\\b(Treaty on the Functioning of the European Union)\\b', re.IGNORECASE)), ('TFEU', re.compile('\\b(TFEU)\\b')), ('TEU', re.compile('\\b(Treaty on European Union)\\b', re.IGNORECASE)), ('TEU', re.compile('\\b(TEU)\\b')), ('TEEC', re.compile('\\b(Treaty establishing the European( Economic)? Community)\\b', re.IGNORECASE)), ('32015R2365', re.compile('\\b(Securities Financing Transaction Regulation)\\b', re.IGNORECASE)), ('32015R2365', re.compile('\\b(SFTR)\\b')), ('32016R0867', re.compile('\\b(Analytical Credit Dataset)\\b', re.IGNORECASE)), ('32016R0867', re.compile('\\b(AnaCredit)\\b')), ('32009L0138', re.compile('\\b(Solvency II)\\b', re.IGNORECASE)), ('32009L0138', re.compile('\\b(Solvency II)\\b')), ('32015L0849', re.compile('\\b(Anti Money Laundering Directive)\\b', re.IGNORECASE)), ('32015L0849', re.compile('\\b(AMLD 4)\\b')), ('32016R1011', re.compile('\\b(Benchmarks Regulation)\\b', re.IGNORECASE)), ('32016R1011', re.compile('\\b(BMR)\\b')), ('32013R1024', re.compile('\\b(Single Supervisory Mechanism)\\b', re.IGNORECASE)), ('32013R1024', re.compile('\\b(SSM)\\b')), ('31962R0031', re.compile('\\b(Staff Regulation)\\b', re.IGNORECASE)), ('31985L0374', re.compile('\\b(Product Liability Directive)\\b', re.IGNORECASE)), ('31987R2658', re.compile('\\b(Combined Nomenclature)\\b', re.IGNORECASE)), ('31992L0043', re.compile('\\b(Habitats Directive)\\b', re.IGNORECASE)), ('31993L0013', re.compile('\\b(Unfair Terms Directive)\\b', re.IGNORECASE)), ('31993L0042', re.compile('\\b(Medical Device Directive)\\b', re.IGNORECASE)), ('31993L0042', re.compile('\\b(MDD)\\b')), ('31994R2257', re.compile('\\b(Banana law)\\b', re.IGNORECASE)), ('31995L0046', re.compile('\\b(Data Protection Directive)\\b', re.IGNORECASE)), ('31996L0071', re.compile('\\b(Posting of Workers Directive)\\b', re.IGNORECASE)), ('31999L0044', re.compile('\\b(Consumer Sales and Guarantees Directive)\\b', re.IGNORECASE)), ('32000L0060', re.compile('\\b(Water Framework Directive)\\b', re.IGNORECASE)), ('32000R1346', re.compile('\\b(Insolvency Regulation)\\b', re.IGNORECASE)), ('32000R2725', re.compile('\\b(Eurodac)\\b', re.IGNORECASE)), ('32001L0029', re.compile('\\b(Copyright Directive)\\b', re.IGNORECASE)), ('32001L0029', re.compile('\\b(Infosoc)\\b')), ('32001L0080', re.compile('\\b(Large Combustion Plants Directive)\\b', re.IGNORECASE)), ('32001L0080', re.compile('\\b(LCP)\\b')), ('32001R2157', re.compile('\\b(societas Europaea)\\b', re.IGNORECASE)), ('32001R2157', re.compile('\\b(SE)\\b')), ('32002F0584', re.compile('\\b(European Arrest Warrant)\\b', re.IGNORECASE)), ('32002F0584', re.compile('\\b(EAW)\\b')), ('32002L0058', re.compile('\\b(e-Privacy Directive)\\b', re.IGNORECASE)), ('32002L0092', re.compile('\\b(Insurance Mediation Directive)\\b', re.IGNORECASE)), ('32003L0086', re.compile('\\b(Family Reunification Directive)\\b', re.IGNORECASE)), ('32003L0088', re.compile('\\b(Working Time Directive)\\b', re.IGNORECASE)), ('32004L0039', re.compile('\\b(Markets in Financial Instruments Directive I)\\b', re.IGNORECASE)), ('32004L0039', re.compile('\\b(MiFID I)\\b')), ('32004R0139', re.compile('\\b(Merger Regulation)\\b', re.IGNORECASE)), ('32004R0261', re.compile('\\b(Flight Compensation Regulation)\\b', re.IGNORECASE)), ('32006L0042', re.compile('\\b(Machinery Directive)\\b', re.IGNORECASE)), ('32006L0112', re.compile('\\b(VAT directive)\\b', re.IGNORECASE)), ('32006L0112', re.compile('\\b(VAT)\\b')), ('32006L0123', re.compile('\\b(Services Directive)\\b', re.IGNORECASE)), ('32006R1893', re.compile('\\b(Statistical Classification of Economic Activities in the European Community)\\b', re.IGNORECASE)), ('32006R1907', re.compile('\\b(Registration)\\b', re.IGNORECASE)), ('32006R1907', re.compile('\\b(REACH)\\b')), ('32006R1924', re.compile('\\b(Health Claims)\\b', re.IGNORECASE)), ('32007L0047', re.compile('\\b(Medical Device Directive)\\b', re.IGNORECASE)), ('32007L0047', re.compile('\\b(MDD)\\b')), ('32007L0064', re.compile('\\b(Payment Services Directive)\\b', re.IGNORECASE)), ('32007L0064', re.compile('\\b(PSD I)\\b')), ('32007R0834', re.compile('\\b(Eco regulation)\\b', re.IGNORECASE)), ('32007R0864', re.compile('\\b(Rome II)\\b', re.IGNORECASE)), ('32007R0864', re.compile('\\b(Rome II)\\b')), ('32008R0440', re.compile('\\b(Registration)\\b', re.IGNORECASE)), ('32008R0440', re.compile('\\b(REACH)\\b')), ('32008R0593', re.compile('\\b(Rome I)\\b', re.IGNORECASE)), ('32008R0593', re.compile('\\b(Rome I)\\b')), ('32008R1272', re.compile('\\b(Globally Harmonized System of Classification and Labelling of Chemicals)\\b', re.IGNORECASE)), ('32008R1272', re.compile('\\b(GHS)\\b')), ('32008R1333', re.compile('\\b(Additives)\\b', re.IGNORECASE)), ('32009L0028', re.compile('\\b(Renewable Energy Directive)\\b', re.IGNORECASE)), ('32009L0065', re.compile('\\b(Undertakings for Collective Investment in Transferable Securities Directive)\\b', re.IGNORECASE)), ('32009L0065', re.compile('\\b(UCITS)\\b')), ('32009L0125', re.compile('\\b(Ecodesign Directive)\\b', re.IGNORECASE)), ('32009L0147', re.compile('\\b(Birds Directive)\\b', re.IGNORECASE)), ('32009R1221', re.compile('\\b(Eco Management and Audit Scheme)\\b', re.IGNORECASE)), ('32009R1221', re.compile('\\b(EMAS III)\\b')), ('32009R1223', re.compile('\\b(Cosmetic Products Regulation)\\b', re.IGNORECASE)), ('32010R0995', re.compile('\\b(EU Timber Regulation)\\b', re.IGNORECASE)), ('32011L0061', re.compile('\\b(Alternative Investment Fund Managers Directive)\\b', re.IGNORECASE)), ('32011L0061', re.compile('\\b(AIFMD)\\b')), ('32011L0062', re.compile('\\b(Falsified Medicines Directive)\\b', re.IGNORECASE)), ('32011L0065', re.compile('\\b(Restriction of Hazardous Substances)\\b', re.IGNORECASE)), ('32011L0065', re.compile('\\b(RoHS)\\b')), ('32011L0083', re.compile('\\b(Consumer Rights Directive)\\b', re.IGNORECASE)), ('32011L0095', re.compile('\\b(Qualification Directive)\\b', re.IGNORECASE)), ('32011L0096', re.compile('\\b(Parent-Subsidiary Directive)\\b', re.IGNORECASE)), ('32011R1169', re.compile('\\b(Food Information to Consumers Regulation)\\b', re.IGNORECASE)), ('32011R1169', re.compile('\\b(FIC)\\b')), ('32012L0018', re.compile('\\b(Seveso III Directive)\\b', re.IGNORECASE)), ('32012L0018', re.compile('\\b(Seveso III)\\b')), ('32012R0236', re.compile('\\b(Short Selling Regulation)\\b', re.IGNORECASE)), ('32012R0531', re.compile('\\b(European Union roaming regulations)\\b', re.IGNORECASE)), ('32012R0531', re.compile('\\b(Eurotariff)\\b')), ('32012R0648', re.compile('\\b(European Market Infrastructure Regulation)\\b', re.IGNORECASE)), ('32012R0648', re.compile('\\b(EMIR)\\b')), ('32012R0650', re.compile('\\b(Succession Regulation)\\b', re.IGNORECASE)), ('32012R0650', re.compile('\\b(Brussels IV)\\b')), ('32012R1215', re.compile('\\b(Brussels I Recast)\\b', re.IGNORECASE)), ('32013L0032', re.compile('\\b(Asylum Procedures Directive)\\b', re.IGNORECASE)), ('32013L0033', re.compile('\\b(Reception Conditions Directive)\\b', re.IGNORECASE)), ('32013L0034', re.compile('\\b(IFRS Directive)\\b', re.IGNORECASE)), ('32013L0034', re.compile('\\b(IFRS)\\b')), ('32013L0036', re.compile('\\b(Capital Requirements Directive)\\b', re.IGNORECASE)), ('32013L0036', re.compile('\\b(CRD)\\b')), ('32013R0575', re.compile('\\b(Capital Requirements Regulation)\\b', re.IGNORECASE)), ('32013R0575', re.compile('\\b(CRR)\\b')), ('32013R0603', re.compile('\\b(EURODAC Regulation)\\b', re.IGNORECASE)), ('32013R0603', re.compile('\\b(EURODAC)\\b')), ('32013R0604', re.compile('\\b(Dublin Regulation)\\b', re.IGNORECASE)), ('32014L0035', re.compile('\\b(Low Voltage Directive)\\b', re.IGNORECASE)), ('32014L0053', re.compile('\\b(Radio Equipment Directive)\\b', re.IGNORECASE)), ('32014L0053', re.compile('\\b(RED)\\b')), ('32014L0059', re.compile('\\b(Bank Recovery and Resolution Directive)\\b', re.IGNORECASE)), ('32014L0059', re.compile('\\b(BRRD)\\b')), ('32014L0065', re.compile('\\b(Markets in Financial Instruments Directive II)\\b', re.IGNORECASE)), ('32014L0065', re.compile('\\b(MiFID II)\\b')), ('32014L0091', re.compile('\\b(Undertakings for Collective Investment in Transferable Securities Directive)\\b', re.IGNORECASE)), ('32014L0091', re.compile('\\b(UCITS V)\\b')), ('32014L0104', re.compile('\\b(Damages Actions Directive)\\b', re.IGNORECASE)), ('32014R0596', re.compile('\\b(Market Abuse Regulation)\\b', re.IGNORECASE)), ('32014R0596', re.compile('\\b(MAR)\\b')), ('32014R0600', re.compile('\\b(Markets in Financial Instruments Regulation)\\b', re.IGNORECASE)), ('32014R0600', re.compile('\\b(MiFIR)\\b')), ('32014R0651', re.compile('\\b(General Block Exemption Regulation)\\b', re.IGNORECASE)), ('32014R0651', re.compile('\\b(GBER)\\b')), ('32014R0806', re.compile('\\b(Single Resolution Mechanism)\\b', re.IGNORECASE)), ('32014R0806', re.compile('\\b(SRMR)\\b')), ('32014R0910', re.compile('\\b(Electronic Identification)\\b', re.IGNORECASE)), ('32014R0910', re.compile('\\b(eIDAS)\\b')), ('32014R1286', re.compile('\\b(Packaged Retail and Insurance-based Investment Products Regulation)\\b', re.IGNORECASE)), ('32014R1286', re.compile('\\b(PRIIPs)\\b')), ('32015L2366', re.compile('\\b(Payment Services Directive)\\b', re.IGNORECASE)), ('32015L2366', re.compile('\\b(PSD II)\\b')), ('32015R0847', re.compile('\\b(Funds Transfer Regulation)\\b', re.IGNORECASE)), ('32016L0097', re.compile('\\b(Insurance Distribution Directive)\\b', re.IGNORECASE)), ('32016L0097', re.compile('\\b(IID)\\b')), ('32016L0798', re.compile('\\b(Railway Safety Directive)\\b', re.IGNORECASE)), ('32016L1148', re.compile('\\b(Network and Information Systems Directive)\\b', re.IGNORECASE)), ('32016L1148', re.compile('\\b(NIS)\\b')), ('32016R0399', re.compile('\\b(Schengen Borders)\\b', re.IGNORECASE)), ('32016R0679', re.compile('\\b(General Data Protection Regulation)\\b', re.IGNORECASE)), ('32016R0679', re.compile('\\b(GDPR)\\b')), ('32017R0745', re.compile('\\b(Medical Device Regulation)\\b', re.IGNORECASE)), ('32017R0745', re.compile('\\b(MDR)\\b')), ('32017R0746', re.compile('\\b(In Vitro Diagnostic Regulation)\\b', re.IGNORECASE)), ('32017R0746', re.compile('\\b(IVDR)\\b')), ('32017R1129', re.compile('\\b(Prospectus Regulation)\\b', re.IGNORECASE)), ('32017R2324', re.compile('\\b(Glyphosate Regulation)\\b', re.IGNORECASE)), ('32000L0031', re.compile('\\b(eCommerce Directive)\\b', re.IGNORECASE)), ('32003R0343', re.compile('\\b(Dublin II)\\b', re.IGNORECASE)), ('32004R0726', re.compile('\\b(EMA)\\b', re.IGNORECASE)), ('32004R0726', re.compile('\\b(EMA)\\b')), ('32008L0048', re.compile('\\b(CCD)\\b', re.IGNORECASE)), ('32008L0048', re.compile('\\b(CCD)\\b')), ('32010R1093', re.compile('\\b(EBA)\\b', re.IGNORECASE)), ('32010R1093', re.compile('\\b(EBA)\\b')), ('32010R1094', re.compile('\\b(EIOPA)\\b', re.IGNORECASE)), ('32010R1094', re.compile('\\b(EIOPA)\\b')), ('32010R1095', re.compile('\\b(ESMA)\\b', re.IGNORECASE)), ('32010R1095', re.compile('\\b(ESMA)\\b')), ('32018L2001', re.compile('\\b(RED II)\\b', re.IGNORECASE)), ('32018L2001', re.compile('\\b(RED II)\\b')), ('32019L0790', re.compile('\\b(Copyright Directive)\\b', re.IGNORECASE)), ('32019L0882', re.compile('\\b(European Accessibility Act)\\b', re.IGNORECASE)), ('32019R0881', re.compile('\\b(ENISA)\\b', re.IGNORECASE)), ('32019R0881', re.compile('\\b(ENISA)\\b')), ('32020R0852', re.compile('\\b(Taxonomy Regulation)\\b', re.IGNORECASE)), ('32017R0821', re.compile('\\b(Conflict Minerals Regulation)\\b', re.IGNORECASE)), ('32014L0095', re.compile('\\b((EU\\s)?Non-financial Reporting Directive)\\b', re.IGNORECASE)), ('32019L1937', re.compile('\\b(Whistleblowing-Directive)\\b'))]}[(language, only_treaties)]

    @staticmethod
    def tag_2_abbreviation(language):
        return {'ES': {'https://es.wikipedia.org/wiki/Tratado_Ant%C3%A1rtico': 'Tratado Antártico', 'TEU': 'TUE', '32016R0679': 'RGPD', '31985R2137': 'AEIE', '32000L0031': 'Directiva sobre el comercio electrónico', '32000L0060': 'DMA', '32001R2157': 'SE', '32002F0584': 'ODE', '32002L0058': 'Directiva sobre la privacidad y las comunicaciones electrónicas', '32003R1435': 'SCE', '32004R0139': 'Reglamento comunitario de concentraciones', '32006R1082': 'AECT', '32006R1907': 'REACH', '32007R0864': 'Roma II', '32007R1393': 'notificación y traslado de documentos', '32008R0593': 'Roma I', '32009L0065': 'OICVM', '32009L0138': 'Solvencia II', '32009R0810': 'Código de visados', '32009R1221': 'EMAS', '32010R1093': 'EBA', '32010R1094': 'Autoridad Europea de Seguros y Pensiones de Jubilación', '32010R1095': 'Autoridad Europea de Valores y Mercados', '32014L0091': 'OICVM', '32014R0596': 'Reglamento sobre abuso de mercado', '32016L0943': 'secretos comerciales', '32016R0399': 'Código de fronteras Schengen', '32018L1808': 'Directiva de servicios de comunicación audiovisual', '32019L0882': 'Acta Europea de Accesibilidad'}, 'DE': {'https://de.wikipedia.org/wiki/Antarktis-Vertrag': 'Antarktis-Vertrag', 'TFEU': 'AEUV', 'CHAR': 'Charta', 'TEU': 'EUV', 'TEEC': 'EGV', '32009L0138': 'Solvabilität II', '31985R2137': 'EWIV', '32001L0029': 'Urheberrechtsrichtlinie', '32001R0044': 'EuGVVO', '32001R2157': 'SE', '32002F0584': 'EuHB', '32003R1435': 'SCE', '32003R2201': 'Brüssel IIa', '32004L0039': 'MiFID I', '32004L0048': 'IPRED', '32004R0139': 'FKVO', '32006L0048': 'CRD', '32006L0112': 'Mehrwertsteuer', '32006R0166': 'Schadstofffreisetzungs- und -verbringungsregister', '32006R1082': 'EVTZ', '32006R1896': 'Europäisches Mahnverfahren', '32006R1907': 'REACH', '32007R0861': 'Verfahren für geringfügige Forderungen', '32007R0864': 'Rom II', '32007R1393': 'Zustellung von Schriftstücken', '32008R0593': 'Rom I', '32009L0065': 'OGAW', '32010R1259': 'Rom III', '32011R1169': 'LMIV', '32012R0648': 'EMIR', '32012R0650': 'Rom IV', '32012R1215': 'EuGVVO', '32013L0034': 'IFRS', '32013L0036': 'CRD', '32013R0575': 'CRR', '32014L0065': 'MiFID II', '32014R0910': 'eIDAS', '32015L2366': 'PSD2', '32016R0679': 'DSGVO', '32006L0068': 'Kapitalgesellschaftsrichtlinie', '32007L0036': 'Aktionärsrechterichtlinie', '32003L0035': 'Öffentlichkeitsbeteiligungsrichtlinie', '32008L0048': 'Verbraucherkreditrichtlinie', '32018L1808': 'Richtlinie über audiovisuelle Mediendienste', '31985L0374': 'Produkthaftungsrichtlinie', '31987R2658': 'Kombinierte Nomenklatur', '31990L0435': 'Mutter-Tochter-Richtlinie', '31992L0043': 'FFH', '31994R2257': 'Bananenverordnung', '31995L0046': 'Datenschutzrichtlinie', '31996L0071': 'Entsenderichtlinie', '32000L0031': 'eCommerce Richtlinie', '32000L0060': 'EU-WRRL', '32000R1346': 'Insolvenzverordnung', '32002L0058': 'ePrivacy-Richtlinie', '32003L0088': 'Arbeitszeitrichtlinie', '32003L0109': 'Daueraufenthaltsrichtlinie', '32003R0343': 'Dublin II', '32004R0261': 'Fluggastrechte-Verordnung', '32004R0726': 'EMA', '32004R0805': 'EG-Vollstr-Titel', '32006L0042': 'Maschinenrichtlinie', '32006L0123': 'Dienstleistungsrichtlinie', '32006R1893': 'NACE', '32007R0834': 'EG-Öko-Basisverordnung', '32008L0115': 'Rückführungsrichtlinie', '32008R1272': 'GHS', '32009L0028': 'RED', '32009L0125': 'ErP', '32009L0147': 'Vogelschutzrichtlinie', '32009R0004': 'EG-UnterhaltsS', '32009R0810': 'Visakodex', '32009R1223': 'Kosmetikverordnung', '32010R0995': 'EUTR', '32010R1093': 'EBA', '32010R1094': 'EIOPA', '32010R1095': 'ESMA', '32011L0061': 'AIFM', '32011L0062': 'Arzneimittelfälschungen', '32011L0083': 'Verbraucherrechte', '32011L0095': 'Qualifikationsrichtlinie', '32011R0492': 'AN-Freizüg', '32012L0018': 'Seveso III', '32012R0531': 'Eurotariff', '32013L0032': 'Asylverfahrensrichtlinie', '32013L0033': 'Aufnahmerichtlinie', '32013R0603': 'Eurodac', '32013R0604': 'Dublin III', '32013R0606': 'Schutzmaßnahmen VO', '32013R1024': 'SSM', '32014L0030': 'EMV', '32014L0035': 'Niederspannungsrichtlinie', '32014L0053': 'RED', '32014L0059': 'BRRD', '32014L0091': 'OGAW', '32014R0600': 'MiFIR', '32014R0651': 'GBER', '32014R0656': 'Seeaußengrenzenverordnung', '32014R0806': 'SRM', '32014R1286': 'PRIIP', '32015L0849': 'AMLD 4', '32015L2436': 'MarkenRL', '32015R0847': 'Geldtransferverordnung', '32016L0943': 'KnowHowRL', '32016R0399': 'SGK', '32016R1011': 'EU Referenzwerte-Verordnung', '32017R0745': 'MDR', '32017R0746': 'IVD', '32017R1001': 'UMV', '32017R1129': 'Prospektverordnung', '32017R2324': 'Glyphosatverordnung', '32018L2001': 'RED II', '32018R0302': 'Geoblocking-VO', '32018R0625': 'DVUM', '32018R0626': 'UMDV', '32018R1806': 'EU-Visum VO', '32019L0790': 'Urheberrechtsrichtlinie', '32019L0882': 'Europäischer Rechtsakt zur Barrierefreiheit', '32019L1151': 'Digitalisierungsrichtlinie', '32019R0881': 'ENISA', '32020R0852': 'Taxonomie-Verordnung', '32019R2088': 'Offenlegungsverordnung', '32019L1937': 'Whistleblower-Richtlinie'}, 'EN': {'https://en.wikipedia.org/wiki/Antarctic_Treaty_System': 'Antarctic Treaty', 'TFEU': 'TFEU', 'TEU': 'TEU', 'TEEC': 'Treaty establishing the European Economic Community', '32015R2365': 'SFTR', '32016R0867': 'AnaCredit', '32009L0138': 'Solvency II', '32015L0849': 'AMLD 4', '32016R1011': 'BMR', '32013R1024': 'SSM', '31962R0031': 'Staff Regulation', '31985L0374': 'Product Liability Directive', '31987R2658': 'Combined Nomenclature', '31992L0043': 'Habitats Directive', '31993L0013': 'Unfair Terms Directive', '31993L0042': 'MDD', '31994R2257': 'Banana law', '31995L0046': 'Data Protection Directive', '31996L0071': 'Posting of Workers Directive', '31999L0044': 'Consumer Sales and Guarantees Directive', '32000L0060': 'Water Framework Directive', '32000R1346': 'Insolvency Regulation', '32000R2725': 'Eurodac', '32001L0029': 'Infosoc', '32001L0080': 'LCP', '32001R2157': 'SE', '32002F0584': 'EAW', '32002L0058': 'e-Privacy Directive', '32002L0092': 'Insurance Mediation Directive', '32003L0086': 'Family Reunification Directive', '32003L0088': 'Working Time Directive', '32004L0039': 'MiFID I', '32004R0139': 'Merger Regulation', '32004R0261': 'Flight Compensation Regulation', '32006L0042': 'Machinery Directive', '32006L0112': 'VAT', '32006L0123': 'Services Directive', '32006R1893': 'Statistical Classification of Economic Activities in the European Community', '32006R1907': 'REACH', '32006R1924': 'Health Claims', '32007L0047': 'MDD', '32007L0064': 'PSD I', '32007R0834': 'Eco regulation', '32007R0864': 'Rome II', '32008R0440': 'REACH', '32008R0593': 'Rome I', '32008R1272': 'GHS', '32008R1333': 'Additives', '32009L0028': 'Renewable Energy Directive', '32009L0065': 'UCITS', '32009L0125': 'Ecodesign Directive', '32009L0147': 'Birds Directive', '32009R1221': 'EMAS III', '32009R1223': 'Cosmetic Products Regulation', '32010R0995': 'EU Timber Regulation', '32011L0061': 'AIFMD', '32011L0062': 'Falsified Medicines Directive', '32011L0065': 'RoHS', '32011L0083': 'Consumer Rights Directive', '32011L0095': 'Qualification Directive', '32011L0096': 'Parent-Subsidiary Directive', '32011R1169': 'FIC', '32012L0018': 'Seveso III', '32012R0236': 'Short Selling Regulation', '32012R0531': 'Eurotariff', '32012R0648': 'EMIR', '32012R0650': 'Brussels IV', '32012R1215': 'Brussels I Recast', '32013L0032': 'Asylum Procedures Directive', '32013L0033': 'Reception Conditions Directive', '32013L0034': 'IFRS', '32013L0036': 'CRD', '32013R0575': 'CRR', '32013R0603': 'EURODAC', '32013R0604': 'Dublin Regulation', '32014L0035': 'Low Voltage Directive', '32014L0053': 'RED', '32014L0059': 'BRRD', '32014L0065': 'MiFID II', '32014L0091': 'UCITS V', '32014L0104': 'Damages Actions Directive', '32014R0596': 'MAR', '32014R0600': 'MiFIR', '32014R0651': 'GBER', '32014R0806': 'SRMR', '32014R0910': 'eIDAS', '32014R1286': 'PRIIPs', '32015L2366': 'PSD II', '32015R0847': 'Funds Transfer Regulation', '32016L0097': 'IID', '32016L0798': 'Railway Safety Directive', '32016L1148': 'NIS', '32016R0399': 'Schengen Borders', '32016R0679': 'GDPR', '32017R0745': 'MDR', '32017R0746': 'IVDR', '32017R1129': 'Prospectus Regulation', '32017R2324': 'Glyphosate Regulation', '32000L0031': 'eCommerce Directive', '32003R0343': 'Dublin II', '32004R0726': 'EMA', '32008L0048': 'CCD', '32010R1093': 'EBA', '32010R1094': 'EIOPA', '32010R1095': 'ESMA', '32018L2001': 'RED II', '32019L0790': 'Copyright Directive', '32019L0882': 'European Accessibility Act', '32019R0881': 'ENISA', '32020R0852': 'Taxonomy Regulation', '32017R0821': 'Conflict Minerals Regulation', '32014L0095': 'Non-financial Reporting Directive', '32019L1937': 'Whistleblowing-Directive'}}[language]

    @staticmethod
    def tag_2_pattern(language, only_treaties=False) -> Dict[str, Pattern]:
        return {('ES', True): {'PND_ABBREV': re.compile(r'\b(TUE)\b', flags=32), 'PND_TITLE': re.compile(r'\b(Tratado de la Unión Europea)\b', flags=32)}, ('ES', False): {'PND_ABBREV': re.compile(r'\b(TUE|RGPD|AEIE|DMA|SE|ODE|SCE|AECT|REACH|Roma II|Roma I|OICVM|EMAS|EBA|OICVM)\b', flags=32), 'PND_TITLE': re.compile(r'\b(Tratado Antártico|Tratado de la Unión Europea|Reglamento General de Protección de Datos|AEIE|Directiva sobre el comercio electrónico|DMA|SE|ODE|Directiva sobre la privacidad y las comunicaciones electrónicas|SCE|Reglamento comunitario de concentraciones|AECT|REACH|Roma II|notificación y traslado de documentos|Roma I|OICVM|Solvencia II|Código de visados|EMAS|EBA|Autoridad Europea de Seguros y Pensiones de Jubilación|Autoridad Europea de Valores y Mercados|OICVM|Reglamento sobre abuso de mercado|secretos comerciales|Código de fronteras Schengen|Directiva de servicios de comunicación audiovisual|Acta Europea de Accesibilidad)\b', flags=32)}, ('DE', True): {'PND_ABBREV': re.compile(r'\b(AEUV|Charta|EUV|EGV)\b', flags=32), 'PND_TITLE': re.compile(r'\b(Vertrags? über die (Arbeitsweise|Funktionsweise) der Europäischen Union|Charta( der Grundrechte der Europäischen Union)?|Vertrags? über die Europäische Union|EU-Vertrags?|Vertrags? zur Gründung der Europäischen Gemeinschaft)\b', flags=32)}, ('DE', False): {'PND_ABBREV': re.compile(r'\b(AEUV|Charta|EUV|EGV|Solvabilität II|EWIV|EuGVVO|SE|EuHB|SCE|Brüssel IIa|MiFID I|IPRED|FKVO|CRD|EVTZ|REACH|Rom II|Rom I|OGAW|Rom III|LMIV|EMIR|Rom IV|EuGVVO|IFRS|CRD|CRR|MiFID II|eIDAS|PSD2|DSGVO|FFH|EU-WRRL|EMA|EG-Vollstr-Titel|NACE|GHS|RED|ErP|EG-UnterhaltsS|EUTR|EBA|EIOPA|ESMA|AIFM|AN-Freizüg|Seveso III|Eurotariff|Eurodac|SSM|EMV|RED|BRRD|OGAW|MiFIR|GBER|SRM|PRIIP|AMLD 4|MarkenRL|KnowHowRL|SGK|MDR|IVD|UMV|RED II|Geoblocking-VO|DVUM|UMDV|ENISA|Offenlegungsverordnung|Whistleblower-Richtlinie)\b', flags=32), 'PND_TITLE': re.compile(r'\b(Antarktis-Vertrags?|Vertrags? über die (Arbeitsweise|Funktionsweise) der Europäischen Union|Charta( der Grundrechte der Europäischen Union)?|Vertrags? über die Europäische Union|EU-Vertrags?|Vertrags? zur Gründung der Europäischen Gemeinschaft|Solvabilität II|Europäische wirtschaftliche Interessenvereinigung|Urheberrechtsrichtlinie|Brüssel-I-Verordnung|Europäische Gesellschaft|Europäischer Haftbefehl|Europäische Genossenschaft|Brüssel IIa|Finanzmarktrichtlinie I|Durchsetzungsrichtlinie|EG-Fusionskontrollverordnung|Tätigkeit der Kreditinstitute|Mehrwertsteuer|Schadstofffreisetzungs- und -verbringungsregister|Europäischer Verbund für territoriale Zusammenarbeit|Europäisches Mahnverfahren|REACH|Verfahren für geringfügige Forderungen|Rom II|Zustellung von Schriftstücken|Rom I|Organismen für gemeinsame Anlagen in Wertpapieren|Rom III|Lebensmittel-Informationsverordnung|Regulierung des außerbörslichen Derivatehandels|Rom IV|EuGVVO|Bilanz-Richtlinie|Kapitaladäquanzrichtlinie|Kapitaladäquanzverordnung|Finanzmarktrichtlinie II|eIDAS|Zahlungsdiensterichtlinie|Datenschutzgrundverordnung|Kapitalgesellschaftsrichtlinie|Aktionärsrechterichtlinie|Öffentlichkeitsbeteiligungsrichtlinie|Verbraucherkreditrichtlinie|Richtlinie über audiovisuelle Mediendienste|Produkthaftungsrichtlinie|Kombinierte Nomenklatur|Mutter-Tochter-Richtlinie|FFH|Bananenverordnung|Datenschutzrichtlinie|Entsenderichtlinie|eCommerce Richtlinie|EU-WRRL|Insolvenzverordnung|ePrivacy-Richtlinie|Arbeitszeitrichtlinie|Daueraufenthaltsrichtlinie|Dublin II|Fluggastrechte-Verordnung|EMA|EG-Vollstr-Titel|Maschinenrichtlinie|Dienstleistungsrichtlinie|NACE|EG-Öko-Basisverordnung|Rückführungsrichtlinie|GHS|RED|ErP|Vogelschutzrichtlinie|EG-UnterhaltsS|Visakodex|Kosmetikverordnung|EUTR|EBA|EIOPA|ESMA|AIFM|Arzneimittelfälschungen|Verbraucherrechte|Qualifikationsrichtlinie|AN-Freizüg|Seveso III|Eurotariff|Asylverfahrensrichtlinie|Aufnahmerichtlinie|Eurodac|Dublin III|Schutzmaßnahmen VO|SSM|EMV|Niederspannungsrichtlinie|RED|BRRD|OGAW|MiFIR|GBER|Seeaußengrenzenverordnung|SRM|PRIIP|AMLD 4|MarkenRL|Geldtransferverordnung|KnowHowRL|SGK|EU Referenzwerte-Verordnung|MDR|IVD|UMV|Prospektverordnung|Glyphosatverordnung|RED II|Geoblocking-VO|DVUM|UMDV|EU-Visum VO|Urheberrechtsrichtlinie|Europäischer Rechtsakt zur Barrierefreiheit|Digitalisierungsrichtlinie|ENISA|Taxonomie-Verordnung|WBRL)\b', flags=32)}, ('EN', True): {'PND_ABBREV': re.compile(r'\b(TFEU|TEU)\b', flags=32), 'PND_TITLE': re.compile(r'\b(Treaty on the Functioning of the European Union|Treaty on European Union|Treaty establishing the European( Economic)? Community)\b', flags=32)}, ('EN', False): {'PND_ABBREV': re.compile(r'\b(TFEU|TEU|SFTR|AnaCredit|Solvency II|AMLD 4|BMR|SSM|MDD|Infosoc|LCP|SE|EAW|MiFID I|VAT|REACH|MDD|PSD I|Rome II|REACH|Rome I|GHS|UCITS|EMAS III|AIFMD|RoHS|FIC|Seveso III|Eurotariff|EMIR|Brussels IV|IFRS|CRD|CRR|EURODAC|RED|BRRD|MiFID II|UCITS V|MAR|MiFIR|GBER|SRMR|eIDAS|PRIIPs|PSD II|IID|NIS|GDPR|MDR|IVDR|EMA|CCD|EBA|EIOPA|ESMA|RED II|ENISA|Whistleblowing-Directive)\b', flags=32), 'PND_TITLE': re.compile(r'\b(Antarctic Treaty|Treaty on the Functioning of the European Union|Treaty on European Union|Treaty establishing the European( Economic)? Community|Securities Financing Transaction Regulation|Analytical Credit Dataset|Solvency II|Anti Money Laundering Directive|Benchmarks Regulation|Single Supervisory Mechanism|Staff Regulation|Product Liability Directive|Combined Nomenclature|Habitats Directive|Unfair Terms Directive|Medical Device Directive|Banana law|Data Protection Directive|Posting of Workers Directive|Consumer Sales and Guarantees Directive|Water Framework Directive|Insolvency Regulation|Eurodac|Copyright Directive|Large Combustion Plants Directive|societas Europaea|European Arrest Warrant|e-Privacy Directive|Insurance Mediation Directive|Family Reunification Directive|Working Time Directive|Markets in Financial Instruments Directive I|Merger Regulation|Flight Compensation Regulation|Machinery Directive|VAT directive|Services Directive|Statistical Classification of Economic Activities in the European Community|Registration|Health Claims|Medical Device Directive|Payment Services Directive|Eco regulation|Rome II|Registration|Rome I|Globally Harmonized System of Classification and Labelling of Chemicals|Additives|Renewable Energy Directive|Undertakings for Collective Investment in Transferable Securities Directive|Ecodesign Directive|Birds Directive|Eco Management and Audit Scheme|Cosmetic Products Regulation|EU Timber Regulation|Alternative Investment Fund Managers Directive|Falsified Medicines Directive|Restriction of Hazardous Substances|Consumer Rights Directive|Qualification Directive|Parent-Subsidiary Directive|Food Information to Consumers Regulation|Seveso III Directive|Short Selling Regulation|European Union roaming regulations|European Market Infrastructure Regulation|Succession Regulation|Brussels I Recast|Asylum Procedures Directive|Reception Conditions Directive|IFRS Directive|Capital Requirements Directive|Capital Requirements Regulation|EURODAC Regulation|Dublin Regulation|Low Voltage Directive|Radio Equipment Directive|Bank Recovery and Resolution Directive|Markets in Financial Instruments Directive II|Undertakings for Collective Investment in Transferable Securities Directive|Damages Actions Directive|Market Abuse Regulation|Markets in Financial Instruments Regulation|General Block Exemption Regulation|Single Resolution Mechanism|Electronic Identification|Packaged Retail and Insurance-based Investment Products Regulation|Payment Services Directive|Funds Transfer Regulation|Insurance Distribution Directive|Railway Safety Directive|Network and Information Systems Directive|Schengen Borders|General Data Protection Regulation|Medical Device Regulation|In Vitro Diagnostic Regulation|Prospectus Regulation|Glyphosate Regulation|eCommerce Directive|Dublin II|EMA|CCD|EBA|EIOPA|ESMA|RED II|Copyright Directive|European Accessibility Act|ENISA|Taxonomy Regulation|Conflict Minerals Regulation|(EU\s)?Non-financial Reporting Directive)\b', flags=32)}}[(language, only_treaties)]


class Connector:
    __tablename__ = 'connector'

    @staticmethod
    def tag_2_pattern(language) -> Dict[str, Pattern]:
        return {'ES': {'COM': re.compile(r',', flags=32), 'RC': re.compile(r'\ba\b', flags=32), 'LF': re.compile(r',\s*[yo]', flags=32), 'AND': re.compile(r'\by( (las?|el|los))?\b', flags=32), 'OTHERX': re.compile(r'\bo\b', flags=32), 'BRCRPL': re.compile(r'\b(y )?sus?\b', flags=32), 'SPECIFIX': re.compile(r', y en particular( (el|l[oa]s?))?', flags=32), 'SPCLPR': re.compile(r'\bdel|de l[ao]s?\b', flags=32), 'SPECIALX': re.compile(r'\bel (título|encabezado)|la (ecuación|tabla)\b', flags=32), 'XDESUX': re.compile(r'\bde sus?\b', flags=32)}, 'DE': {'SEPARATE': re.compile(r'\bund de[srn]\b', flags=32), 'COM': re.compile(r',', flags=32), 'SPECIFIX': re.compile(r'(,|und) insbesondere auf\b', flags=32), 'SPPLCR': re.compile(r'\bunter den\b', flags=32), 'BRCRPL': re.compile(r'\bdessen\b', flags=32), 'RC': re.compile(r'\bbis\b', flags=32), 'LF': re.compile(r',\s*(und|oder)', flags=32), 'AND': re.compile(r'\bund\b', flags=32), 'OTHERX': re.compile(r'\boder\b', flags=32), 'XPREVX': re.compile(r'\bjene[rs]|de[rs] genannten|des\b', flags=32), 'SPCLPR': re.compile(r'\b(de[rs]|von|zum)\b', flags=32), 'SPECIALX': re.compile(r'\bder Titel|die (Überschrift|Gleichung|Tabelle)\b', flags=32)}, 'EN': {'THEREOF': re.compile(r'\bthereof\b', flags=32), 'RC': re.compile(r'\bto\b', flags=32), 'COM': re.compile(r',', flags=32), 'LF': re.compile(r',\s*(and\b|or\b)', flags=32), 'AND': re.compile(r'\band\b', flags=32), 'OTHERX': re.compile(r'\b(or|except)\b', flags=32), 'XPREVX': re.compile(r'\b((of|to) that)|of the\b', flags=32), 'SPCLPR': re.compile(r'\bof( the)?\b', flags=32), 'SPECIFIX': re.compile(r', and in particular', flags=32), 'SPECIALX': re.compile(r'\bthe (title|heading|equation|table)\b', flags=32)}}[language]
