Skip to main content
reval is a Go library that provides standard evaluation metrics for information retrieval and natural language generation tasks. It covers ranking quality (Precision, Recall, NDCG), text overlap (ROUGE), and semantic similarity (BERTScore) — all in a single package with zero dependencies.

Quickstart

Install the library and run your first evaluation in minutes.

Metrics Reference

Full API documentation for every exported function and type.

Ranking Evaluation Guide

Learn how to measure search and recommendation quality end-to-end.

Text Generation Guide

Evaluate summarization and generation output with ROUGE and BERTScore.

What’s included

Precision & Recall

Precision@K, Average Precision, Mean Average Precision, and Recall@K.

NDCG

Normalized Discounted Cumulative Gain with graded relevance support.

ROUGE

ROUGE-1, ROUGE-L, and ROUGE-Lsum for text summarization evaluation.

BERTScore

Semantic similarity scoring using dense vector embeddings.

Key properties

  • Zero dependencies — only the Go standard library
  • Graded relevance — all ranking metrics accept integer relevance scores, not just binary labels
  • Precision, recall, and F1 — ROUGE and BERTScore return all three components
  • Floating-point safe — built-in IsClose and IsZero helpers for reliable numeric comparisons

Build docs developers (and LLMs) love