import re


def _clean(entity_frag):
    """
    Clean the given trunk (text contains entity and pattern)
    by removal of the leading and tailing puncutions and stopwords
    """
    stopwords = '(of|in|to|and|or|the|a)'
    head_regex = r'^\s*{}\b'.format(stopwords)
    tail_regex = r'\b{}\s*$'.format(stopwords)
    joined_regex = r'|'.join([head_regex, tail_regex])
    return re.sub(joined_regex, '', entity_frag).strip(' -,')