Skip to main content

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

  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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codegen_metrics-0.2.0.tar.gz (115.6 kB view hashes)

Uploaded Source

Built Distribution

codegen_metrics-0.2.0-py3-none-any.whl (65.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page