當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。