rl4lms.envs.text_generation.caption_metrics package
Subpackages
Submodules
rl4lms.envs.text_generation.caption_metrics.cider module
- rl4lms.envs.text_generation.caption_metrics.cider.precook(s, n=4, out=False)[source]
Takes a string as input and returns an object that can be given to either cook_refs or cook_test. This is optional: cook_refs and cook_test can take string arguments as well. :param s: string : sentence to be converted into ngrams :param n: int : number of ngrams for which representation is calculated :return: term frequency vector for occuring ngrams
- rl4lms.envs.text_generation.caption_metrics.cider.cook_refs(refs, n=4)[source]
Takes a list of reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them. :param refs: list of string : reference sentences for some image :param n: int : number of ngrams for which (ngram) representation is calculated :return: result (list of dict)
- rl4lms.envs.text_generation.caption_metrics.cider.cook_test(test, n=4)[source]
Takes a test sentence and returns an object that encapsulates everything that BLEU needs to know about it. :param test: list of string : hypothesis sentence for some image :param n: int : number of ngrams for which (ngram) representation is calculated :return: result (dict)
- class rl4lms.envs.text_generation.caption_metrics.cider.CiderScorer(test=None, refs=None, n=4, sigma=6.0)[source]
Bases:
objectCIDEr scorer.
- cook_append(test, refs)[source]
called by constructor and __iadd__ to avoid creating new instances.