sparse_caption.coco_caption.pycocoevalcap.rouge package
Submodules
sparse_caption.coco_caption.pycocoevalcap.rouge.rouge module
- class sparse_caption.coco_caption.pycocoevalcap.rouge.rouge.Rouge
Bases:
objectClass for computing ROUGE-L score for a set of candidate sentences for the MS COCO test set
- calc_score(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)
- compute_score(gts, res)
Computes Rouge-L score given a set of reference and candidate sentences for the dataset Invoked by evaluate_captions.py :param hypo_for_image: dict : candidate / test sentences with “image name” key and “tokenized sentences” as values :param ref_for_image: dict : reference MS-COCO sentences with “image name” key and “tokenized sentences” as values :returns: average_score: float (mean ROUGE-L score computed by averaging scores for all the images)
- method()
- sparse_caption.coco_caption.pycocoevalcap.rouge.rouge.my_lcs(string, sub)
Calculates longest common subsequence for a pair of tokenized strings :param string : list of str : tokens from a string split using whitespace :param sub : list of str : shorter string, also split using whitespace :returns: length (list of int): length of the longest common subsequence between the two strings
Note: my_lcs only gives length of the longest common subsequence, not the actual LCS
Module contents
Created on 09 Jul 2020 23:36:50 @author: jiahuei