def filter_keyphrases_brat(raw_ann):
    """Receive raw content in brat format and return keyphrases"""
    filter_keyphrases = map(lambda t: t.split('\t'), filter(lambda t: t[:1] ==
        'T', raw_ann.split('\n')))
    keyphrases = {}
    for keyphrase in filter_keyphrases:
        keyphrase_key = keyphrase[0]
        if ';' in keyphrase[1]:
            label_span = keyphrase[1].replace(';', ' ').split()
            span_str = [min(label_span[1:]), max(label_span[1:])]
        else:
            label_span = keyphrase[1].split()
            span_str = label_span[1:]
        label = label_span[0]
        span = int(span_str[0]), int(span_str[1])
        text = keyphrase[2]
        keyphrases[keyphrase_key] = {'keyphrase-label': label,
            'keyphrase-span': span, 'keyphrase-text': text,
            'tokens-indices': []}
    return keyphrases
