How to use the sacrebleu._avg_precision_and_recall function in sacrebleu

To help you get started, we’ve selected a few sacrebleu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebookresearch / vizseq / vizseq / scorers / chrf.py View on Github external
corpus_statistics = [0 for _ in range(sb.CHRF_ORDER * 3)]
            with ProcessPoolExecutor(max_workers=self.n_workers) as executor:
                futures = [
                    executor.submit(
                        sb.get_corpus_statistics, b[0], b[1][0]
                    )
                    for b in batches
                ]
                progress = as_completed(futures)
                if self.verbose:
                    progress = tqdm(progress)
                for future in progress:
                    stats = future.result()
                    for i in range(sb.CHRF_ORDER * 3):
                        corpus_statistics[i] += stats[i]
            avg_precision, avg_recall = sb._avg_precision_and_recall(
                corpus_statistics, sb.CHRF_ORDER
            )
            corpus_score = sb._chrf(avg_precision, avg_recall)
        return corpus_score