add browser warning

This commit is contained in:
2023-07-17 18:44:18 +02:00
parent 26ca9984ea
commit 4eb1e8c049
277 changed files with 3228202 additions and 19 deletions

View File

@@ -0,0 +1,23 @@
import type {Chord} from "$lib/serial/chord"
import {KEYMAP_CODES} from "$lib/serial/keymap-codes"
interface Language {
name: string
noLazyMode?: boolean
orderedByFrequency?: boolean
words: string[]
}
export async function calculateChordCoverage(chords: Chord[]) {
const language: Language = await fetch("/languages/english.json").then(it => it.json())
const words = new Set(language.words)
for (const chord of chords) {
words.delete(chord.phrase.map(it => KEYMAP_CODES[it].id!).join(""))
}
return {
coverage: words.size / language.words.length,
missing: [...words.values()],
}
}