Documentation ¶
Overview ¶
Package alphabet implements word-spelling alphabets. Clients should not use this internal package, used by github.com/simonnagl/spell/cmd/spell.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( English = SpellingAlphabet{ // contains filtered or unexported fields } BritishEnglish = SpellingAlphabet{ // contains filtered or unexported fields } French = SpellingAlphabet{ // contains filtered or unexported fields } Dutch = SpellingAlphabet{ // contains filtered or unexported fields } German = SpellingAlphabet{ // contains filtered or unexported fields } AustrianGerman = SpellingAlphabet{ // contains filtered or unexported fields } SwissHighGerman = SpellingAlphabet{ // contains filtered or unexported fields } Italian = SpellingAlphabet{ // contains filtered or unexported fields } Spanish = SpellingAlphabet{ // contains filtered or unexported fields } Turkish = SpellingAlphabet{ // contains filtered or unexported fields } Norwegian = SpellingAlphabet{ // contains filtered or unexported fields } Swedish = SpellingAlphabet{ // contains filtered or unexported fields } Finnish = SpellingAlphabet{ // contains filtered or unexported fields } Danish = SpellingAlphabet{ // contains filtered or unexported fields } Czech = SpellingAlphabet{ // contains filtered or unexported fields } EuropeanPortuguese = SpellingAlphabet{ // contains filtered or unexported fields } BrazilianPortuguese = SpellingAlphabet{ // contains filtered or unexported fields } Romanian = SpellingAlphabet{ // contains filtered or unexported fields } Slovenian = SpellingAlphabet{ // contains filtered or unexported fields } Russian = SpellingAlphabet{ // contains filtered or unexported fields } Ukrainian = SpellingAlphabet{ // contains filtered or unexported fields } )
var All = []SpellingAlphabet{ English, BritishEnglish, French, Dutch, German, AustrianGerman, SwissHighGerman, Italian, Spanish, Turkish, Norwegian, Swedish, Finnish, Danish, Czech, EuropeanPortuguese, BrazilianPortuguese, Romanian, Slovenian, Russian, Ukrainian, }
All SpellingAlphabet.
Functions ¶
func Lookup ¶ added in v0.3.0
func Lookup(lang string) (SpellingAlphabet, Exactness)
Lookup returns the best matching SpellingAlphabet of All together with a confidence score.
Lookup interprets lang as a BCP 47 language tag and finds the best match for the SpellingAlphabets lang. golang.org/x/text/language is used for finding the best match. If there is no match, 'en' is used as the default SpellingAlphabet.
Types ¶
type Exactness ¶ added in v0.3.1
type Exactness int
Exactness indicates the level of certainty for a given return value. The confidence level indicates whether a value was explicitly specified, whether it is a educated guess, or whether it is the default value.
func FromLangConfidence ¶ added in v0.3.1
func FromLangConfidence(c language.Confidence) Exactness
type SpellingAlphabet ¶
type SpellingAlphabet struct {
// contains filtered or unexported fields
}
SpellingAlphabet represents a word-spelling alphabet.
SpellingAlphabet is a set of words used to pronounce the letters of an alphabet in oral communication.
func (SpellingAlphabet) LangEnglishName ¶ added in v0.3.1
func (sa SpellingAlphabet) LangEnglishName() string
LangEnglishName returns the full description in English, which language uses SpellingAlphabet.
func (SpellingAlphabet) LangSelfName ¶ added in v0.3.1
func (sa SpellingAlphabet) LangSelfName() string
LangEnglishName returns the full description which language uses SpellingAlphabet, in this language.
func (SpellingAlphabet) LangTag ¶ added in v0.3.1
func (sa SpellingAlphabet) LangTag() string
LangTag returns a BCP 47 tag, describing where SpellingAlphabet is used.
func (SpellingAlphabet) Names ¶ added in v0.3.0
func (sa SpellingAlphabet) Names() []string
Names of organisations or standards, defining or using this SpellingAlphabet.
func (SpellingAlphabet) Spell ¶
func (sa SpellingAlphabet) Spell(text string) string
Spell generates the text to speak for spelling text.