From 4e6d7e63a9e8ad2e7ed89cc003df62a189c7fe44 Mon Sep 17 00:00:00 2001 From: Ayush Shaurya Jha <164651751+jhaayush2004@users.noreply.github.com> Date: Sun, 11 Aug 2024 21:29:23 +0530 Subject: [PATCH] Update evaluator.py --- rag-evaluator/evaluator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rag-evaluator/evaluator.py b/rag-evaluator/evaluator.py index 857a3c93..30e5ae18 100644 --- a/rag-evaluator/evaluator.py +++ b/rag-evaluator/evaluator.py @@ -8,7 +8,8 @@ def __init__(self, model_name='paraphrase-MiniLM-L6-v2', top_n_keywords=50): self.model = SentenceTransformer(model_name) self.tokenizer = GPT2Tokenizer.from_pretrained('gpt2') self.top_n_keywords = top_n_keywords - + + '''Defining evaluate_semantic_similarity''' def evaluate_semantic_similarity(self, reference_text, generated_text): reference_embedding = self.model.encode(reference_text).reshape(1, -1) generated_embedding = self.model.encode(generated_text).reshape(1, -1)