def metric_rr(pred_tokens_list, true_tokens):
    """
        Calculate Reciprocal Rank
        pred_tokens_list: list of pred_tokens candidates
        Example:
            pred_tokens_list = [['catten'], ['black', 'cat'], ['cats']]
            true_tokens = ['black', 'cat']
            RR = 1/2
    """
    rank, reciprocal_rank = 0, 0
    candidate_count = 0
    for pred_tokens in pred_tokens_list:
        candidate_count += 1
        if pred_tokens == true_tokens:
            rank = candidate_count
            break
        
    if rank != 0:      
        reciprocal_rank = 1 / rank      
    return reciprocal_rank