(self, candidate, refs)
return score
Compute ROUGE-L score given one candidate and references for an image
        :param candidate: str : candidate sentence to be evaluated
        :param refs: list of str : COCO reference sentences for the particular image to be evaluated
        :returns score: int (ROUGE-L score for the candidate evaluated against references)
Compute ROUGE-L score given one candidate and references for an image
        :param candidate: str : candidate sentence to be evaluated
        :param refs: list of str : COCO reference sentences for the particular image to be evaluated
        :returns score: int (ROUGE-L score for the candidate evaluated against references)
Compute ROUGE - L score given one candidate and references for an image : param candidate : str : candidate sentence to be evaluated : param refs : list of str : COCO reference sentences for the particular image to be evaluated : returns score : int ( ROUGE - L score for the candidate evaluated against references )
def calc_score(self, candidate, refs):
        """
        Compute ROUGE-L score given one candidate and references for an image
        :param candidate: str : candidate sentence to be evaluated
        :param refs: list of str : COCO reference sentences for the particular image to be evaluated
        :returns score: int (ROUGE-L score for the candidate evaluated against references)
        """
        assert(len(candidate)==1)
        assert(len(refs)>0)
        prec = []
        rec = []

        # split into tokens
        token_c = candidate[0].split(" ")

        for reference in refs:
            # split into tokens
            token_r = reference.split(" ")
            # compute the longest common subsequence
            lcs = my_lcs(token_r, token_c)
            prec.append(lcs/float(len(token_c)))
            rec.append(lcs/float(len(token_r)))

        prec_max = max(prec)
        rec_max = max(rec)

        if(prec_max!=0 and rec_max !=0):
            score = ((1 + self.beta**2)*prec_max*rec_max)/float(rec_max + self.beta**2*prec_max)
        else:
            score = 0.0
        return score
def calc_score ( self , candidate , refs ) : assert ( len ( candidate ) == 1 ) assert ( len ( refs ) > 0 ) prec = [ ] rec = [ ] # split into tokens token_c = candidate [ 0 ] . split ( " " ) for reference in refs : # split into tokens token_r = reference . split ( " " ) # compute the longest common subsequence lcs = my_lcs ( token_r , token_c ) prec . append ( lcs / float ( len ( token_c ) ) ) rec . append ( lcs / float ( len ( token_r ) ) ) prec_max = max ( prec ) rec_max = max ( rec ) if ( prec_max != 0 and rec_max != 0 ) : score = ( ( 1 + self . beta ** 2 ) * prec_max * rec_max ) / float ( rec_max + self . beta ** 2 * prec_max ) else : score = 0.0 return score