Files
screenreader-common/phonetic/phonetic.go
T
ak47 e7bd1d0043 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.
2026-11-12 23:24:14 -05:00

19 lines
689 B
Go

// 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']
}