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.
```rust use tet_rs::TextEntryThroughput;
// A preset for English alphabet is provided. // An explanation for other language texts is wrote on later. let tet = TextEntryThroughput::alphabetletterdistribution();
let presentedtext = "my watch fell in the waterprevailing wind from the east"; let transcribedtext = "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(presentedtext, transcribedtext, s).unwrap(); assert!((throughput - 12.954965333409255).abs() < 0.0001); ```
First, prepare a distribution of characters to get entropy H(X)
from source.
```rust
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); ```
```rust // 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.
toml: Cargo.toml
tet_rs = { version = "0.1", features = ["serde1"] }