# [기술] Rouge Score

안규원·2024년 6월 30일

AI

목록 보기
21/22

[정의]


ROUGE, or Recall-Oriented Understudy for Gisting Evaluation, is a set of metrics and a software package used for evaluating automatic summarization and machine translation software in natural language processing. The metrics compare an automatically produced summary or translation against a reference or a set of references (human-produced) summary or translation. ROUGE metrics range between 0 and 1, with higher scores indicating higher similarity between the automatically produced summary and the reference.

ROUGERecall-Oriented Understudy for Gisting Evaluation 텍스트 요약 및 생성 모델의 성능을 평가하기 위한 대표적인 지표
생성된 텍스트와 참조 텍스트(Reference Text) 사이의 유사성을 측정

[유형]


  • ROUGE-N: N-그램의 일치 정도를 기반으로 하는 지표
    ROUGE-1 Unigram 단어 수준의 일치 정도를 측정
    ROUGE-2 Bigram 두 단어 쌍의 일치 정도를 측정

  • ROUGE-L: 장문 일치 (Longest Common Subsequence, LCS)를 기반으로 하는 지표
    문장 또는 문단의 순서를 고려하여 일치 정도를 측정

  • ROUGE-W: 가중치가 부여된 LCS를 기반으로 하는 지표더 긴 일치 부분에 높은 가중치를 부여

[계산 방법]


  • Recall: 참조 텍스트에서 생성된 텍스트와 일치하는 부분의 비율
  • Precision: 생성된 텍스트에서 참조 텍스트와 일치하는 부분의 비율
  • F1-Score: Recall과 Precision의 조화 평균

[장단점]


장점단점
간단하고 직관적문맥을 고려하지 않음
다양한 측면에서 유사성 평가동의어가 서로 단어로 표현되면 점수가 낮아질 수 있음
여러 언어와 도메인에서 적용 가능질적인 측면이나 창의성 등 정교한 평가는 제한됨

[Example]


from rouge_score import rouge_scorer

# 참조 텍스트와 생성된 텍스트 정의
reference = "The quick brown fox jumps over the lazy dog."
generated = "The fast brown fox leaps over the lazy dog."

# ROUGE 점수 계산을 위한 Scorer 초기화
scorer = rouge_scorer.RougeScorer(['rouge1', 'rouge2', 'rougeL'], use_stemmer=True)
scores = scorer.score(reference, generated)

# 결과 출력
print("ROUGE-1:", scores['rouge1'])
print("ROUGE-2:", scores['rouge2'])
print("ROUGE-L:", scores['rougeL'])

0개의 댓글