-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c71c62d
Showing
63 changed files
with
2,198 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bleuscore" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod sys"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bleuscore/index.html">bleuscore</a><span class="version">0.1.2</span></h2></div><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.BleuScore.html">BleuScore</a></li><li><a href="struct.Tokenizer13a.html">Tokenizer13a</a></li><li><a href="struct.TokenizerRegex.html">TokenizerRegex</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.Tokenizer.html">Tokenizer</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="fn.compute_score.html">compute_score</a></li></ul></section></div></main></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="refresh" content="0;URL=../../bleuscore/fn.compute_score.html"> | ||
<title>Redirection</title> | ||
</head> | ||
<body> | ||
<p>Redirecting to <a href="../../bleuscore/fn.compute_score.html">../../bleuscore/fn.compute_score.html</a>...</p> | ||
<script>location.replace("../../bleuscore/fn.compute_score.html" + location.search + location.hash);</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="refresh" content="0;URL=../../bleuscore/struct.BleuScore.html"> | ||
<title>Redirection</title> | ||
</head> | ||
<body> | ||
<p>Redirecting to <a href="../../bleuscore/struct.BleuScore.html">../../bleuscore/struct.BleuScore.html</a>...</p> | ||
<script>location.replace("../../bleuscore/struct.BleuScore.html" + location.search + location.hash);</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="compute the BLEU score with `Tokenizer13a` as default tokenizer. The implementation is based on huggingface/nmt"><title>compute_score in bleuscore - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bleuscore" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bleuscore/index.html">bleuscore</a><span class="version">0.1.2</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">bleuscore</a>::<wbr><a class="fn" href="#">compute_score</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/bleuscore/bleu.rs.html#35-141">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn compute_score( | ||
references: &[<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>], | ||
predictions: &[<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>], | ||
max_order: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, | ||
smooth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> | ||
) -> <a class="struct" href="struct.BleuScore.html" title="struct bleuscore::BleuScore">BleuScore</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>compute the BLEU score with <code>Tokenizer13a</code> as default tokenizer. | ||
The implementation is based on <a href="https://github.com/huggingface/evaluate/blob/main/metrics/bleu/bleu.py">huggingface/nmt</a></p> | ||
</div></details></section></div></main></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="bleuscore is a BLEU score calculator written in pure rust."><title>bleuscore - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bleuscore" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bleuscore/index.html">bleuscore</a><span class="version">0.1.2</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <a class="mod" href="#">bleuscore</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/bleuscore/lib.rs.html#1-97">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>bleuscore is a <a href="https://en.wikipedia.org/wiki/BLEU">BLEU</a> score calculator written in pure rust.</p> | ||
<h2 id="install"><a class="doc-anchor" href="#install">§</a>Install:</h2> | ||
<p>The crate is called <code>bleuscore</code> and you can depend on it via cargo:</p> | ||
<div class="example-wrap"><pre class="language-ini"><code>[dependencies] | ||
bleuscore = "*" | ||
</code></pre></div><h2 id="features"><a class="doc-anchor" href="#features">§</a>Features:</h2> | ||
<ul> | ||
<li>Tokenized BLEU score calculation like | ||
<a href="https://github.com/huggingface/evaluate/blob/main/metrics/bleu/bleu.py">huggingface evaluate</a> | ||
and <a href="https://github.com/mjpost/sacrebleu">sacrebleu</a></li> | ||
</ul> | ||
<h2 id="basic-usage"><a class="doc-anchor" href="#basic-usage">§</a>Basic usage:</h2> | ||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bleuscore::compute_score; | ||
|
||
<span class="comment">// get the references and prediction data: | ||
</span><span class="kw">let </span>references: Vec<Vec<String>> = <span class="macro">vec!</span>[<span class="macro">vec!</span>[<span class="string">"Hello, World!"</span>.to_string()]]; | ||
<span class="kw">let </span>predictions: Vec<String> = <span class="macro">vec!</span>[<span class="string">"Yellow, World!"</span>.to_string()]; | ||
|
||
<span class="comment">// set the parameters: | ||
</span><span class="kw">let </span>max_order: usize = <span class="number">4</span>; | ||
<span class="kw">let </span>smooth: bool = <span class="bool-val">true</span>; | ||
|
||
<span class="comment">// calculate the BLEU score: | ||
</span><span class="kw">let </span>res = compute_score(<span class="kw-2">&</span>references, <span class="kw-2">&</span>predictions, max_order, smooth); | ||
<span class="macro">println!</span>(<span class="string">"result: {:?}"</span>, res); | ||
<span class="comment">// result: BleuScore { bleu: 0.668740304976422, precisions: [0.8, 0.75, 0.6666666666666666, 0.5], | ||
// brevity_penalty: 1.0, length_ratio: 1.0, translation_length: 4, reference_length: 4 }</span></code></pre></div> | ||
<p>!</p> | ||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.BleuScore.html" title="struct bleuscore::BleuScore">BleuScore</a></div><div class="desc docblock-short">The BLEU score data struct</div></li><li><div class="item-name"><a class="struct" href="struct.Tokenizer13a.html" title="struct bleuscore::Tokenizer13a">Tokenizer13a</a></div><div class="desc docblock-short">Same implementation with <a href="https://github.com/huggingface/evaluate/blob/main/metrics/bleu/tokenizer_13a.py">huggingface/sacrebleu</a></div></li><li><div class="item-name"><a class="struct" href="struct.TokenizerRegex.html" title="struct bleuscore::TokenizerRegex">TokenizerRegex</a></div><div class="desc docblock-short">Same implementation with <a href="https://github.com/huggingface/evaluate/blob/main/metrics/bleu/tokenizer_13a.py">huggingface/sacrebleu</a></div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Tokenizer.html" title="trait bleuscore::Tokenizer">Tokenizer</a></div><div class="desc docblock-short">tokenize function is used to tokenize the strings</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.compute_score.html" title="fn bleuscore::compute_score">compute_score</a></div><div class="desc docblock-short">compute the BLEU score with <code>Tokenizer13a</code> as default tokenizer. | ||
The implementation is based on <a href="https://github.com/huggingface/evaluate/blob/main/metrics/bleu/bleu.py">huggingface/nmt</a></div></li></ul></section></div></main></body></html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.