Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

piglatin state

Back to all declarations

suffixVowel

untyped string

Value

"way"

suffixConsonant

untyped string

Value

"ay"

isLetter

func(r int32) bool

isLetter reports whether r is an ASCII/unicode letter (word character).

Open
OID
04c4d7…7cde:5
isLetter details

Inspect func

translateWord

func(word string) string

translateWord converts a single "core" alphabetic word (no surrounding punctuation) to Pig Latin, preserving its capitalization pattern.

Open
OID
04c4d7…7cde:6
translateWord details

Inspect func

applyCase

func(orig string, translated string) string

applyCase re-applies the capitalization shape of the original word to the translated word. Two common shapes are handled: ALL CAPS and Title-case; everything else is returned lowercase.

Open
OID
04c4d7…7cde:7
applyCase details

Inspect func

splitAffixes

func(token string) (string, string, string)

splitAffixes separates a token into (leading punctuation, core word, trailing punctuation) where the core is the contiguous run of letters (apostrophes inside are kept as part of the core, e.g. "don't").

Open
OID
04c4d7…7cde:8
splitAffixes details

Inspect func

TranslateToken

func(token string) string

TranslateToken translates a single whitespace-delimited token, preserving any punctuation glued to its edges.

Open
OID
04c4d7…7cde:9
TranslateToken details

Inspect func

Translate

func(sentence string) string

Translate applies Pig Latin to every word in the sentence while preserving the original whitespace between words.

Open
OID
04c4d7…7cde:10
Translate details

Inspect func

Render

func(path string) string

Render is the gnoweb entrypoint (Markdown). Root explains the rules; any other path is treated as a sentence to translate, e.g. Render("/Hello world").

Open
OID
04c4d7…7cde:11
Render details

Inspect func
suffixVowel : untyped string ="way"
suffixConsonant : untyped string ="ay"
isVowel : func(r int32) bool Inspect
isLetter : func(r int32) bool Inspect
translateWord : func(word string) string Inspect
applyCase : func(orig string, translated string) string Inspect
splitAffixes : func(token string) (string, string, string) Inspect
TranslateToken : func(token string) string Inspect
Translate : func(sentence string) string Inspect
Render : func(path string) string Inspect