<jupyter_start><jupyter_text>Evaludation Metrics - Rouge- BlueScore<jupyter_code>from rouge import Rouge 
hypothesis = "daman administration on wednesday withdrew a circular asked women staff to tie rakhis on male colleagues after the order triggered a backlash to celebrate the circular that made it compulsory for its staff to celebrate rakshabandhan at workplace and diu administrator ."
reference = "The Administration of Union Territory Daman and Diu has revoked its order that made it compulsory for women to tie rakhis to their male colleagues on the occasion of Rakshabandhan on August 7. The administration was forced to withdraw the decision within 24 hours of issuing the circular after it received flak from employees and was slammed on social media."
rouge = Rouge()
scores = rouge.get_scores(hypothesis, reference)
scores
# two references for one document
from nltk.translate.bleu_score import corpus_bleu
from nltk.tokenize import word_tokenize

references = [[['this', 'is', 'a', 'test'], ['this', 'is' 'test']]]
candidates = [['this', 'is', 'a', 'test']]
score = corpus_bleu(references, candidates)
print(score)
candidates = word_tokenize(hypothesis)
print(len(candidates))
import nltk
nltk.download('punkt')
hypothesis = "daman administration on wednesday withdrew a circular asked women staff to tie rakhis on male colleagues after the order triggered a backlash to celebrate the circular that made it compulsory for its staff to celebrate rakshabandhan at workplace and diu administrator .".split()
reference = "The Administration of Union Territory Daman and Diu has revoked its order that made it compulsory for women to tie rakhis to their male colleagues on the occasion of Rakshabandhan on August 7. The administration was forced to withdraw the decision within 24 hours of issuing the circular after it received flak from employees and was slammed on social media.".split()
references = word_tokenize(hypothesis)
print(references)
candidates = word_tokenize(reference)
print(candidates)
BLEUscore = nltk.translate.bleu_score.corpus_bleu([reference], [candidates], weights = [0.1])
print(BLEUscore)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06409660938225732, 'fraction_numerical': 0.0037157454714352067, 'mean_word_length': 6.03921568627451, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '59464', 'license': 'MIT', 'n_tokens_mistral': 614, 'n_tokens_neox': 559, 'n_words': 268, 'path': 'codebase/abstractive_summarization/AbstractiveSummarization_EazyMindAPI.ipynb', 'repo_name': 'RN0311/DataX-2-PlakshaTLF', 'size': '2153'}