Package for computation of code generation metrics
Project description
Metrics for Code Generation
A library for running
Installation
To start using the library, install it via pip or use your favorite package manager:
pip install codegen-metrics
Usage
To start using the library, import a metric and pass to it the reference code and the generated one.
Please, notice! You should call it as metric(reference_code, generated_code), not the other way around!
from codegen_metrics import bleu, chrf, codebleu, meteor, rougel, ruby
metrics = (bleu, chrf, codebleu, meteor, rougel, ruby)
generated_code = "def hello():\n\tprint('Hello, world!')"
reference_code = "def bye(name: str):\n\tprint(f'bye, {name}!')"
for metric in metrics:
print(metric(reference_code, generated_code))
Remarks
- Computation of RUBY involves comparison of graphs and takes a lot of time.
- On the initial run, the library will setup
tree-sitterandnltkwhich may take some time.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codegen_metrics-0.2.0.tar.gz.
File metadata
- Download URL: codegen_metrics-0.2.0.tar.gz
- Upload date:
- Size: 115.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-69-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61a8d42251f0b85ae77c562608498d911f62e97f6ccf0c96667bac40e98f01b2
|
|
| MD5 |
1fd2738334707cd21cdb899bd0194e88
|
|
| BLAKE2b-256 |
606fae7ef9a63b78024d3ee9f900a14e6cbdeb203b45afe9e5ad074e44c2f2a4
|
File details
Details for the file codegen_metrics-0.2.0-py3-none-any.whl.
File metadata
- Download URL: codegen_metrics-0.2.0-py3-none-any.whl
- Upload date:
- Size: 65.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-69-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6162ed5c5ab0844e7a52c4896667392d4419ffe92bb37f6d3ab637379f67a302
|
|
| MD5 |
880d93e22c7e6d9e99209786140234f5
|
|
| BLAKE2b-256 |
1fd6f9ffc264a628e1ad4f0f3ddabea217801bbe6276faf5e17b4bd0965627cb
|