Compile search patterns for optional attributes if needed.

def _init_compile_patterns(optional_attrs):
        """Compile search patterns for optional attributes if needed."""
        attr2cmp = {}
        if optional_attrs is None:
            return attr2cmp
        # "peptidase inhibitor complex" EXACT [GOC:bf, GOC:pr]
        # "blood vessel formation from pre-existing blood vessels" EXACT systematic_synonym []
        # "mitochondrial inheritance" EXACT []
        # "tricarboxylate transport protein" RELATED [] {comment="WIkipedia:Mitochondrial_carrier"}
        if 'synonym' in optional_attrs:
            attr2cmp['synonym'] = re.compile(r'"(\S.*\S)" ([A-Z]+) (.*)\[(.*)\](.*)$')
            attr2cmp['synonym nt'] = cx.namedtuple("synonym", "text scope typename dbxrefs")
        # Wikipedia:Zygotene
        # Reactome:REACT_27267 "DHAP from Ery4P and PEP, Mycobacterium tuberculosis"
        if 'xref' in optional_attrs:
            attr2cmp['xref'] = re.compile(r'^(\S+:\s*\S+)\b(.*)$')
        return attr2cmp