Skip to main content

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

  1. Computation of RUBY involves comparison of graphs and takes a lot of time.
  2. On the initial run, the library will setup tree-sitter and nltk which may take some time.

Metadata

Release files for codegen-metrics 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codegen-metrics 0.2.0
File Size Uploaded Provenance Actions
codegen_metrics-0.2.0.tar.gz 115.6 kB Without provenance Details for codegen_metrics-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for codegen-metrics 0.2.0
File Interpreter ABI Platform Actions
codegen_metrics-0.2.0-py3-none-any.whl Python 3 none any Details for codegen_metrics-0.2.0-py3-none-any.whl

Total release size: 181.4 kB

Release files / codegen_metrics-0.2.0.tar.gz

Download URL codegen_metrics-0.2.0.tar.gz
Size 115.6 kB
Tags Source
SHA-256 checksum
How to use checksums
61a8d42251f0b85ae77c562608498d911f62e97f6ccf0c96667bac40e98f01b2
BLAKE2b-256 checksum
How to use checksums
606fae7ef9a63b78024d3ee9f900a14e6cbdeb203b45afe9e5ad074e44c2f2a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-69-generic

Release files / codegen_metrics-0.2.0-py3-none-any.whl

Download URL codegen_metrics-0.2.0-py3-none-any.whl
Size 65.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6162ed5c5ab0844e7a52c4896667392d4419ffe92bb37f6d3ab637379f67a302
BLAKE2b-256 checksum
How to use checksums
1fd6f9ffc264a628e1ad4f0f3ddabea217801bbe6276faf5e17b4bd0965627cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-69-generic

Security for codegen-metrics 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page