<commit_before>from collections import defaultdict
from .annotation import Matcher

try:
    keys = dict.viewkeys
except Exception:
    # Py3k
    keys = dict.keys


MATCHERS = {
    'strong_mention_match':         Matcher(['span']),
    'strong_linked_mention_match':  Matcher(['span'], 'is_linked'),
    'strong_link_match':            Matcher(['span', 'kbid'], 'is_linked'),
    'strong_nil_match':             Matcher(['span'], 'is_nil'),
    'strong_all_match':             Matcher(['span', 'kbid']),
    'strong_typed_all_match':       Matcher(['span', 'type', 'kbid']),
    'entity_match':                 Matcher(['span', 'kbid'], 'is_linked'),

    'b_cubed_plus':                 Matcher(['span', 'kbid'], agg='b_cubed'),
}

for name in ['muc', 'b_cubed', 'entity_ceaf', 'mention_ceaf', 'pairwise',
             'cs_b_cubed', 'entity_cs_ceaf', 'mention_cs_ceaf']:
    MATCHERS[name] = Matcher(['span'], agg=name)


# Configuration constants
ALL_MATCHES = 'all'
ALL_TAGGING = 'all-tagging'
ALL_COREF = 'all-coref'
TAC_MATCHES = 'tac'
TAC14_MATCHES = 'tac14'
TMP_MATCHES = 'tmp'
CORNOLTI_WWW13_MATCHES = 'cornolti'
HACHEY_ACL14_MATCHES = 'hachey'
LUO_MATCHES = 'luo'
CAI_STRUBE_MATCHES = 'cai'

MATCH_SETS = {
    ALL_MATCHES: [
        'all-tagging',
        'all-coref',
        ],
    ALL_TAGGING: {
        'strong_mention_match',
        'strong_linked_mention_match',
        'strong_link_match',
        'strong_nil_match',
        'strong_all_match',
        'strong_typed_all_match',
        'entity_match',
    },
    ALL_COREF: {
        'entity_match',
        'mention_ceaf',
        'entity_ceaf',
        'b_cubed',
        'pairwise',
        'muc',
        #'mention_cs_ceaf',
        #'entity_cs_ceaf',
        #'cs_b_cubed',
        'b_cubed_plus',
    },
    CORNOLTI_WWW13_MATCHES: [
        'strong_linked_mention_match',
        'strong_link_match',
        'entity_match',
        ],
    HACHEY_ACL14_MATCHES: [
        'strong_mention_match',  # full ner
        'strong_linked_mention_match',
        'strong_link_match',
        'entity_match',
        ],
    LUO_MATCHES: [
        'muc',
        'b_cubed',
        'mention_ceaf',
        'entity_ceaf',
        ],
    CAI_STRUBE_MATCHES: [
        'cs_b_cubed',
        'mention_cs_ceaf',
    ],
    TAC_MATCHES: [
        'strong_link_match',  # recall equivalent to kb accuracy before 2014
        'strong_nil_match',  # recall equivalent to nil accuracy before 2014
        'strong_all_match',  # equivalent to overall accuracy before 2014
        'strong_typed_all_match',  # wikification f-score for TAC 2014

        'mention_ceaf',
        'b_cubed',
        'b_cubed_plus',
        ],
    TAC14_MATCHES: [
        'strong_typed_all_match',  # wikification f-score for TAC 2014
    ],
    TMP_MATCHES: [
        'mention_ceaf',<commit_msg>Hide Cai-Strube variants<commit_after>from collections import defaultdict
from .annotation import Matcher

try:
    keys = dict.viewkeys
except Exception:
    # Py3k
    keys = dict.keys


MATCHERS = {
    'strong_mention_match':         Matcher(['span']),
    'strong_linked_mention_match':  Matcher(['span'], 'is_linked'),
    'strong_link_match':            Matcher(['span', 'kbid'], 'is_linked'),
    'strong_nil_match':             Matcher(['span'], 'is_nil'),
    'strong_all_match':             Matcher(['span', 'kbid']),
    'strong_typed_all_match':       Matcher(['span', 'type', 'kbid']),
    'entity_match':                 Matcher(['span', 'kbid'], 'is_linked'),

    'b_cubed_plus':                 Matcher(['span', 'kbid'], agg='b_cubed'),
}

for name in ['muc', 'b_cubed', 'entity_ceaf', 'mention_ceaf', 'pairwise',
             #'cs_b_cubed', 'entity_cs_ceaf', 'mention_cs_ceaf']:
             ]:
    MATCHERS[name] = Matcher(['span'], agg=name)


# Configuration constants
ALL_MATCHES = 'all'
ALL_TAGGING = 'all-tagging'
ALL_COREF = 'all-coref'
TAC_MATCHES = 'tac'
TAC14_MATCHES = 'tac14'
TMP_MATCHES = 'tmp'
CORNOLTI_WWW13_MATCHES = 'cornolti'
HACHEY_ACL14_MATCHES = 'hachey'
LUO_MATCHES = 'luo'
CAI_STRUBE_MATCHES = 'cai'

MATCH_SETS = {
    ALL_MATCHES: [
        'all-tagging',
        'all-coref',
        ],
    ALL_TAGGING: {
        'strong_mention_match',
        'strong_linked_mention_match',
        'strong_link_match',
        'strong_nil_match',
        'strong_all_match',
        'strong_typed_all_match',
        'entity_match',
    },
    ALL_COREF: {
        'entity_match',
        'mention_ceaf',
        'entity_ceaf',
        'b_cubed',
        'pairwise',
        'muc',
        #'mention_cs_ceaf',
        #'entity_cs_ceaf',
        #'cs_b_cubed',
        'b_cubed_plus',
    },
    CORNOLTI_WWW13_MATCHES: [
        'strong_linked_mention_match',
        'strong_link_match',
        'entity_match',
        ],
    HACHEY_ACL14_MATCHES: [
        'strong_mention_match',  # full ner
        'strong_linked_mention_match',
        'strong_link_match',
        'entity_match',
        ],
    LUO_MATCHES: [
        'muc',
        'b_cubed',
        'mention_ceaf',
        'entity_ceaf',
        ],
    #CAI_STRUBE_MATCHES: [
    #    'cs_b_cubed',
    #    'entity_cs_ceaf',
    #    'mention_cs_ceaf',
    #],
    TAC_MATCHES: [
        'strong_link_match',  # recall equivalent to kb accuracy before 2014
        'strong_nil_match',  # recall equivalent to nil accuracy before 2014
        'strong_all_match',  # equivalent to overall accuracy before 2014
        'strong_typed_all_match',  # wikification f-score for TAC 2014

        'mention_ceaf',
        'b_cubed',
        'b_cubed_plus',
        ],
    TAC14_MATCHES: [
        'strong_typed_all_match',  # wikification f-score for TAC 2014
    ],
    TMP_MATCHES: [
        'mention_ceaf',
{'fraction_non_alphanumeric': 0.1327047319713637, 'fraction_numerical': 0.012222804260520342, 'mean_word_length': 2.524923076923077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5772935', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2089, 'n_words': 330}