BleuNet 1.0.2
dotnet add package BleuNet --version 1.0.2
NuGet\Install-Package BleuNet -Version 1.0.2
<PackageReference Include="BleuNet" Version="1.0.2" />
paket add BleuNet --version 1.0.2
#r "nuget: BleuNet, 1.0.2"
// Install BleuNet as a Cake Addin #addin nuget:?package=BleuNet&version=1.0.2 // Install BleuNet as a Cake Tool #tool nuget:?package=BleuNet&version=1.0.2
BlueNet
Overview
This library is a C# class library for calculating the BLEU and RIBES scores, which are metrics for evaluating the quality of machine translations. BLEU (Bilingual Evaluation Understudy) is an algorithm for evaluating the quality of text which has been machine-translated from one natural language to another. RIBES (Rank-based Intuitive Bilingual Evaluation Score) is an automatic metric for machine translation evaluation that is based on rank correlation coefficients between word pairs of reference and candidate translations.
Installation
You can add this library to your project using the NuGet package manager.
Install-Package BleuNet
Usage
The following code snippet shows the basic usage of this library.
using BleuNet;
// Define the translated and reference sentences.
string referenceSentence = "The pessimist sees difficulty in every opportunity.";
string translatedSentence = "The pessimist sees difficulty at every opportunity.";
var referenceSentenceTokens = new string[][] { Utility.Tokenize(referenceSentence) };
var translatedSentenceTokens = new string[][] { Utility.Tokenize(translatedSentence) };
// Calculate the BLEU score.
double score = Metrics.CorpusBleu(referenceSentenceTokens, translatedSentenceTokens);
// Display the result.
Console.WriteLine("BLEU Score: " + score);
// Calculate the sentence BLEU score.
double sentenceBleu = Metrics.SentenceBleu(referenceSentenceTokens, Utility.Tokenize(translatedSentence));
Console.WriteLine("Sentence BLEU Score: " + sentenceBleu);
New Update: Tokenize2 Method
I have added a new method Tokenize2
to my library. This method's tokenization is designed to closely match the tokenization of the tokenizer.perl script included with the statistical machine translation tool Moses when specified with -l en.
Here is a basic usage example:
string text = "The quick brown fox jumps over the lazy dog.";
string[] tokens = Utility.Tokenize2(text);
References
BLEU:
- Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu, "BLEU: a Method for Automatic Evaluation of Machine Translation" (Papineni et al., ACL 2002)
RIBES:
- Hideki Isozaki, Tsutomu Hirao, Kevin Duh, Katsuhito Sudoh, Hajime Tsukada, "Automatic Evaluation of Translation Quality for Distant Language Pairs" (Isozaki et al., EMNLP 2010)
License
This project is licensed under the MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Framework | net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
-
.NETFramework 4.6.2
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7.1
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7.2
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.8
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.8.1
- System.ValueTuple (>= 4.5.0)
-
net6.0
- System.ValueTuple (>= 4.5.0)
-
net8.0
- System.ValueTuple (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.