Calculate METEOR score for the prediction.
(prediction: str, reference: str)
| 83 | } |
| 84 | |
| 85 | def calculate_meteor_score(prediction: str, reference: str) -> float: |
| 86 | """Calculate METEOR score for the prediction.""" |
| 87 | try: |
| 88 | return meteor_score([reference.split()], prediction.split()) |
| 89 | except Exception as e: |
| 90 | print(f"Error calculating METEOR score: {e}") |
| 91 | return 0.0 |
| 92 | |
| 93 | def calculate_sentence_similarity(prediction: str, reference: str) -> float: |
| 94 | """Calculate sentence embedding similarity using SentenceBERT.""" |