Share date, voice, tone, spelling, and hardware behavior
Provide common date/time formatting, locale voice matching, tone synthesis, phonetic spelling, and one hardware synthesizer protocol encoder for both readers. Standardize whiskey and x ray and use the tested Fenrir DECtalk mapping. Validated the common module with GOWORK=off go test -race ./...; reader integration, serial cancellation, PCM hashes, no-CGO datetime, and speech regression checks passed. Physical keyboard, audible synthesis, and braille acceptance remain separate live checks.
This commit is contained in:
1 parent
b9a33f7578
commit
e7bd1d0043
15 files changed
+809
-3
No files matched your search
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// Authors: Storm Dragon, Angus Kola
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// Package phonetic supplies the common spelling alphabet.
|
||||
package phonetic
|
||||
|
||||
import "unicode"
|
||||
|
||||
// Letter returns a lowercase spelling word, or empty for non-Latin letters.
|
||||
func Letter(char rune) string {
|
||||
words := [...]string{"alpha", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliet", "kilo", "lima", "mike", "november", "oscar", "papa", "quebec", "romeo", "sierra", "tango", "uniform", "victor", "whiskey", "x ray", "yankee", "zulu"}
|
||||
char = unicode.ToLower(char)
|
||||
if char < 'a' || char > 'z' {
|
||||
return ""
|
||||
}
|
||||
return words[char-'a']
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
package phonetic
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSharedSpellingAndFallback(t *testing.T) {
|
||||
for _, row := range []struct {
|
||||
char rune
|
||||
want string
|
||||
}{{'a', "alpha"}, {'A', "alpha"}, {'w', "whiskey"}, {'W', "whiskey"}, {'x', "x ray"}, {'X', "x ray"}, {'É', ""}, {'界', ""}, {'1', ""}} {
|
||||
if got := Letter(row.char); got != row.want {
|
||||
t.Fatal(row, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user