Skip to content

Commit

Permalink
Update evaluator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaayush2004 authored Aug 11, 2024
1 parent 8f9a3b2 commit 4e6d7e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rag-evaluator/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4e6d7e6

Please sign in to comment.