| Crates.io | tet_rs |
| lib.rs | tet_rs |
| version | 0.3.1 |
| created_at | 2021-03-27 07:29:26.736846+00 |
| updated_at | 2021-04-21 07:10:44.286885+00 |
| description | A third-party implementation of Text Entry Throughput (ref. https://doi.org/10.1145/3290605.3300866) for Rust |
| homepage | |
| repository | https://github.com/KaiseiYokoyama/tet |
| max_upload_size | |
| id | 374119 |
| size | 28,409 |
Text entry throughput introduced by Minguri et al. is a text entry method-independent throughput metric based on Shannon information theory.
This crate is a third-party implementation of TET.
use tet_rs::TextEntryThroughput;
// A preset for English alphabet is provided.
// An explanation for other language texts is wrote on later.
let tet = TextEntryThroughput::alphabet_letter_distribution();
let presented_text = "my watch fell in the waterprevailing wind from the east";
let transcribed_text = "my wacch fell in waterpreviling wind on the east";
let s = std::time::Duration::from_secs(12); // 4 characters per second
let throughput = tet.calc(presented_text, transcribed_text, s).unwrap();
assert!((throughput - 12.954965333409255).abs() < 0.0001);
First, prepare a distribution of characters to get entropy H(X) from source.
use tet_rs::{Frequencies, Distribution};
let mut frequency = Frequencies::new();
// get frequency of each character
let source = "large and appropriate text is recommended";
source.chars()
.for_each(|c| {
frequency.record(c.clone());
});
// normalize frequency to get distribution
let distribution = Distribution::new(frequency);
// now you can calculate TET! :+1:
let tet = TextEntryThroughput::new(distribution);
// Of course, you can use also multibyte characters
// ref. https://doc.rust-lang.org/std/primitive.char.html
let (presented, transcribed) = ("うまぴょい", "うまぽい");
let s = std::time::Duration::from_secs(2); // 4 characters per minute
// Text Entry Throughput (bits/second)
let throughput = tet.calc(presented, transcribed, s).unwrap();
serde1 feature allows you to save and load Frequencies
and Distribution via JSON.
tet_rs = { version = "0.1", features = ["serde1"] }