You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

bleu-score

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bleu-score

Calculate BLEU score for reference and candidate sentences.

1.0.4
latest
npmnpm
Version published
Weekly downloads
1.3K
-21.53%
Maintainers
1
Weekly downloads
 
Created
Source

bleu

Calculate BLEU score for reference and candidate sentences.

Installation

To use the bleu package in your project, you can install it via npm or yarn:

npm install bleu

Usage

Here's an example of how to calculate the BLEU score using the bleu function:

const { bleu } = require('bleu');

const reference = "This is a sample reference sentence.";
const candidate = "This is a sample candidate sentence.";
const maxN = 4;

const bleuScore = bleu(reference, candidate, maxN);

console.log(`BLEU Score: ${bleuScore}`);

If you are using TypeScript, you can also use it:

import { bleu } from 'bleu';

const reference = "This is a sample reference sentence.";
const candidate = "This is a sample candidate sentence.";
const maxN = 4;

const bleuScore = bleu(reference, candidate, maxN);

console.log(`BLEU Score: ${bleuScore}`);

API

bleu(reference: string, candidate: string, maxN: number): number Calculates the BLEU score for a reference sentence and a candidate sentence. The maxN parameter specifies the maximum n-gram to consider for precision.

  • reference: The reference sentence.
  • candidate: The candidate sentence.
  • maxN: The maximum n-gram to consider for precision.

License

This package is released under the MIT License. See the LICENSE file for details.

Contributing

If you'd like to contribute to this project or report issues, please visit the GitHub repository.

Keywords

BLEU

FAQs

Package last updated on 29 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts