def sanitize_wordpiece(wordpiece: str) ->str:
    """
    Sanitizes wordpieces from BERT or RoBERTa tokenizers.
    """
    if wordpiece.startswith('##'):
        return wordpiece[2:]
    elif wordpiece.startswith('Ġ'):
        return wordpiece[1:]
    else:
        return wordpiece
