Metadata-Version: 2.4
Name: matcha-metric
Version: 0.1.6
Summary: MATCHA: Matching Text via Contrastive Semantic Alignment
Author: Siran Li, Ece Sena Etoglu, Carsten Eickhoff, Seyed Ali Bahrainian
License-Expression: CC-BY-NC-SA-4.0
Project-URL: Homepage, https://github.com/Siran-Li/MATCHA
Project-URL: Paper, https://arxiv.org/abs/2605.27345
Project-URL: Model, https://huggingface.co/Siran-Li/MATCHA
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: torch>=2.0
Requires-Dist: transformers>=4.20
Requires-Dist: huggingface_hub>=0.14
Requires-Dist: captum>=0.6
Requires-Dist: numpy

# MATCHA — Matching Text via Contrastive Semantic Alignment

A learned text similarity metric that captures both semantic alignment and contradiction through contrastive training.

**Paper:** [MATCHA](https://arxiv.org/abs/2605.27345) | **Model:** [HuggingFace](https://huggingface.co/Siran-Li/MATCHA) | **Code:** [GitHub](https://github.com/Siran-Li/MATCHA)

## Installation

```bash
pip install matcha-metric
```

## Usage

```python
from matcha_metric import MATCHA

model = MATCHA.from_pretrained("Siran-Li/MATCHA")

# Score a pair of texts
similarity = model.score("A dog is playing in the park.", "A puppy is running outside.")
print(f"Similarity: {similarity:.4f}")

# Batch scoring
scores = model.score(
    ["The cat sat on the mat.", "It is raining outside."],
    ["A feline rested on the rug.", "The weather is sunny and clear."],
)

# Get embeddings directly
embeddings = model.encode(["Hello world", "Hi there"])
```

## Citation

```bibtex
@article{li2026matcha,
  title={MATCHA: Matching Text via Contrastive Semantic Alignment},
  author={Li, Siran and Etoglu, Ece Sena and Eickhoff, Carsten and Bahrainian, Seyed Ali},
  journal={arXiv preprint arXiv:2605.27345},
  year={2026}
}
```
