当前位置: 首页>>代码示例>>Python>>正文


Python bleu_scorer.BleuScorer方法代码示例

本文整理汇总了Python中bleu_scorer.BleuScorer方法的典型用法代码示例。如果您正苦于以下问题:Python bleu_scorer.BleuScorer方法的具体用法?Python bleu_scorer.BleuScorer怎么用?Python bleu_scorer.BleuScorer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bleu_scorer的用法示例。


在下文中一共展示了bleu_scorer.BleuScorer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):

        assert(gts.keys() == res.keys())
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) >= 1)

            bleu_scorer += (hypo[0], ref)

        #score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=1)
        #score, scores = bleu_scorer.compute_score(option='average', verbose=1)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:hadyelsahar,项目名称:Zeroshot-QuestionGeneration,代码行数:26,代码来源:bleu.py

示例2: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):

        assert(sorted(gts.keys()) == sorted(res.keys()))
        imgIds = list(gts.keys())

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) >= 1)

            bleu_scorer += (hypo[0], ref)

        #score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=1)
        #score, scores = bleu_scorer.compute_score(option='average', verbose=1)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:spacemanidol,项目名称:MSMARCO,代码行数:26,代码来源:bleu.py

示例3: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):

        assert(gts.keys() == res.keys())
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) > 1)

            bleu_scorer += (hypo[0], ref)

        #score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=1)
        #score, scores = bleu_scorer.compute_score(option='average', verbose=1)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:InnerPeace-Wu,项目名称:densecap-tensorflow,代码行数:26,代码来源:bleu.py

示例4: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):

        assert(set(gts.keys()) == set(res.keys()))
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) >= 1)

            bleu_scorer += (hypo[0], ref)

        #score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=0)
        #score, scores = bleu_scorer.compute_score(option='average', verbose=1)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:danieljl,项目名称:keras-image-captioning,代码行数:26,代码来源:bleu.py

示例5: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):

        assert(gts.keys() == res.keys())
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) >= 1)

            bleu_scorer += (hypo[0], ref)

        #score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=0)
        #score, scores = bleu_scorer.compute_score(option='average', verbose=1)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:yanghoonkim,项目名称:NQG_ASs2s,代码行数:26,代码来源:bleu.py

示例6: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):

        # assert(gts.keys() == res.keys())
        assert(sorted(gts.keys()) == sorted(res.keys()))
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) >= 1)

            bleu_scorer += (hypo[0], ref)

        #score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=1)
        #score, scores = bleu_scorer.compute_score(option='average', verbose=1)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:eric-xw,项目名称:AREL,代码行数:27,代码来源:bleu.py

示例7: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):
        
        assert (gts.keys() == res.keys())
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert (type(hypo) is list)
            assert (len(hypo) == 1)
            assert (type(ref) is list)
            assert (len(ref) >= 1)

            bleu_scorer += (hypo[0], ref)

        # score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=1)
        # score, scores = bleu_scorer.compute_score(option='average', verbose=1)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:sheffieldnlp,项目名称:deepQuest,代码行数:26,代码来源:bleu.py

示例8: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):
        assert(sorted(gts.keys()) == sorted(res.keys()))
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) > 1)

            bleu_scorer += (hypo[0], ref)

        #score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=0)
        #score, scores = bleu_scorer.compute_score(option='average', verbose=0)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:fukun07,项目名称:neural-image-captioning,代码行数:25,代码来源:bleu.py

示例9: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):
        """

        :param gts:
        :param res:
        :return:
        """
        assert(gts.keys() == res.keys())
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) > 0)

            bleu_scorer += (hypo[0], ref)

        score, scores = bleu_scorer.compute_score(option='closest', verbose=1)

        return score, scores 
开发者ID:harpribot,项目名称:deep-summarization,代码行数:28,代码来源:bleu.py

示例10: compute_score

# 需要导入模块: import bleu_scorer [as 别名]
# 或者: from bleu_scorer import BleuScorer [as 别名]
def compute_score(self, gts, res):

        #assert(gts.keys() == res.keys())
        assert(set(gts.keys()) == set(res.keys()))
        imgIds = gts.keys()

        bleu_scorer = BleuScorer(n=self._n)
        for id in imgIds:
            hypo = res[id]
            ref = gts[id]

            #import pdb; pdb.set_trace()
            # Sanity check.
            assert(type(hypo) is list)
            assert(len(hypo) == 1)
            assert(type(ref) is list)
            assert(len(ref) >= 1)

            bleu_scorer += (hypo[0], ref)

        #score, scores = bleu_scorer.compute_score(option='shortest')
        score, scores = bleu_scorer.compute_score(option='closest', verbose=1)
        #score, scores = bleu_scorer.compute_score(option='average', verbose=1)

        # return (bleu, bleu_info)
        return score, scores 
开发者ID:rakshithShetty,项目名称:captionGAN,代码行数:28,代码来源:bleu.py


注:本文中的bleu_scorer.BleuScorer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。