> For the complete documentation index, see [llms.txt](https://docs.raga.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/code-generation/chrf.md).

# ChrF

Apply ChrF metrics to measure text similarity. Use it for machine translation and summarization evaluation

**Objective:**

ChrF evaluates code generation models by calculating character-level n-gram overlaps between generated code and reference solutions. It is a token-agnostic metric that assesses the similarity in structure and detail, providing a character-level view of accuracy, ideal for detecting subtle code variations or formatting issues.

**Required Columns in Dataset:**

`Generated Code`, `Reference Code`

**Interpretation:**

* **High ChrF:** Indicates high similarity to the reference code, reflecting consistency in both syntax and function.
* **Low ChrF:** Shows potential differences in code structure, which may affect readability or correctness.

**Execution via UI:**

<figure><img src="https://1811327582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbIiNdp1QbG4avl7VShw%2Fuploads%2FfNEhATpawI8yzHLypSHi%2FScreenshot%202024-10-28%20at%204.47.22%E2%80%AFPM.png?alt=media&amp;token=311318e3-c9fc-4813-8e89-4dc52ff2cb43" alt=""><figcaption></figcaption></figure>

**Execution via SDK:**

```python
metrics=[
    {"name": "ChrF", "schema_mapping": {"generated_code": "Generated Code", "reference_code": "Reference Code"}}
]

```
