Remove trigram anamoly calculation

Decided that this wasn't worth it and bigram anamolies are enough.
This commit is contained in:
2026-04-11 00:11:45 +00:00
parent d1fde5c0c1
commit 232f93e054
26 changed files with 23 additions and 489 deletions

View File

@@ -2,7 +2,7 @@ use criterion::{Criterion, black_box, criterion_group, criterion_main};
use keydr::engine::key_stats::KeyStatsStore;
use keydr::engine::ngram_stats::{
BigramKey, BigramStatsStore, TrigramStatsStore, extract_ngram_events,
BigramKey, BigramStatsStore, extract_ngram_events,
};
use keydr::session::result::KeyTime;
@@ -20,14 +20,14 @@ fn make_keystrokes(count: usize) -> Vec<KeyTime> {
fn bench_extraction(c: &mut Criterion) {
let keystrokes = make_keystrokes(500);
c.bench_function("extract_ngram_events (500 keystrokes)", |b| {
c.bench_function("extract_bigrams (500 keystrokes)", |b| {
b.iter(|| extract_ngram_events(black_box(&keystrokes), 800.0))
});
}
fn bench_update(c: &mut Criterion) {
let keystrokes = make_keystrokes(500);
let (bigram_events, _) = extract_ngram_events(&keystrokes, 800.0);
let bigram_events = extract_ngram_events(&keystrokes, 800.0);
c.bench_function("bigram_stats update (400 events)", |b| {
b.iter(|| {
@@ -93,11 +93,10 @@ fn bench_history_replay(c: &mut Criterion) {
c.bench_function("history replay (500 drills x 300 keystrokes)", |b| {
b.iter(|| {
let mut bigram_stats = BigramStatsStore::default();
let mut trigram_stats = TrigramStatsStore::default();
let mut key_stats = KeyStatsStore::default();
for (drill_idx, keystrokes) in drills.iter().enumerate() {
let (bigram_events, trigram_events) = extract_ngram_events(keystrokes, 800.0);
let bigram_events = extract_ngram_events(keystrokes, 800.0);
for kt in keystrokes {
if kt.correct {
@@ -117,18 +116,9 @@ fn bench_history_replay(c: &mut Criterion) {
drill_idx as u32,
);
}
for ev in &trigram_events {
trigram_stats.update(
ev.key.clone(),
ev.total_time_ms,
ev.correct,
ev.has_hesitation,
drill_idx as u32,
);
}
}
(bigram_stats, trigram_stats, key_stats)
(bigram_stats, key_stats)
})
});
}