Documentation ¶
Index ¶
- Constants
- Variables
- func CreateWeights(values map[string]string) map[string]float64
- func DecreaseWeight(weights map[string]float64, key string)
- func IncreaseWeight(weights map[string]float64, key string)
- func ListAddFixedLength(list []string, value string, max int) []string
- func ListHas(list []string, value string) bool
- func Merge(sets ...map[string]string) map[string]string
- func SelectCount(values map[string]string, count int) map[string]string
- func SelectWeighted(values map[string]string, weights map[string]float64) (kana, roman string)
Constants ¶
View Source
const ( WeightDefault = 1.0 WeightIncreaseFactor = 8.0 WeightDecreaseFactor = 2.0 WeightMax = 512.0 WeightMin = 0.0625 )
Weight Constants
Variables ¶
View Source
var Hiragana = map[string]string{
"あ": "a",
"い": "i",
"う": "u",
"え": "e",
"お": "o",
"か": "ka",
"き": "ki",
"く": "ku",
"け": "ke",
"こ": "ko",
"さ": "sa",
"し": "shi",
"す": "su",
"せ": "se",
"そ": "so",
"た": "ta",
"ち": "chi",
"つ": "tsu",
"て": "te",
"と": "to",
"な": "na",
"に": "ni",
"ぬ": "nu",
"ね": "ne",
"の": "no",
"は": "ha",
"ひ": "hi",
"ふ": "fu",
"へ": "he",
"ほ": "ho",
"ま": "ma",
"み": "mi",
"む": "mu",
"め": "me",
"も": "mo",
"や": "ya",
"ゆ": "yu",
"よ": "yo",
"ら": "ra",
"り": "ri",
"る": "ru",
"れ": "re",
"ろ": "ro",
"わ": "wa",
"を": "wo",
"ん": "n",
"が": "ga",
"ぎ": "gi",
"ぐ": "gu",
"げ": "ge",
"ご": "go",
"ざ": "za",
"じ": "ji",
"ず": "zu",
"ぜ": "ze",
"ぞ": "zo",
"だ": "da",
"ぢ": "di",
"づ": "du",
"で": "de",
"ど": "do",
"ば": "ba",
"び": "bi",
"ぶ": "bu",
"べ": "be",
"ぼ": "bo",
"ぱ": "pa",
"ぴ": "pi",
"ぷ": "pu",
"ぺ": "pe",
"ぽ": "po",
}
Hiragana are mappings between kana and their roman equivalent.
View Source
var Katakana = map[string]string{
"ア": "a",
"イ": "i",
"ウ": "u",
"エ": "e",
"オ": "o",
"カ": "ka",
"キ": "ki",
"ク": "ku",
"ケ": "ke",
"コ": "ko",
"サ": "sa",
"シ": "shi",
"ス": "su",
"セ": "se",
"ソ": "so",
"ナ": "na",
"ニ": "ni",
"ヌ": "nu",
"ネ": "ne",
"ノ": "no",
"ハ": "ha",
"ヒ": "hi",
"フ": "fu",
"ヘ": "he",
"ホ": "ho",
"マ": "ma",
"ミ": "mi",
"ム": "mu",
"メ": "me",
"モ": "mo",
"ラ": "ra",
"リ": "ri",
"ル": "ru",
"レ": "re",
"ロ": "ro",
"ワ": "wa",
"ヲ": "wo",
"ヤ": "ya",
"ユ": "yu",
"ヨ": "yo",
"タ": "ta",
"チ": "chi",
"ツ": "tsu",
"テ": "te",
"ト": "to",
"ン": "n",
"ガ": "ga",
"ギ": "gi",
"グ": "gu",
"ゲ": "ge",
"ゴ": "go",
"ザ": "za",
"ジ": "zi",
"ズ": "zu",
"ゼ": "ze",
"ゾ": "zo",
"ヂ": "di",
"ヅ": "du",
"デ": "de",
"ド": "do",
"バ": "ba",
"ビ": "bi",
"ブ": "bu",
"ベ": "be",
"ボ": "bo",
"パ": "pa",
"ピ": "pi",
"プ": "pu",
"ペ": "pe",
"ポ": "po",
}
Katakana are mappings between kana and their roman equivalent.
View Source
var KatakanaWords = map[string]string{
"カメラ": "camera",
"コーヒー": "coffee",
"ビール": "beer",
"オレンジ": "orange",
"ガラス": "glass",
"コンピューター": "computer",
"テレビ": "television",
"ラップトップ": "laptop",
"ホテル": "hotel",
"コンビニ": "convenience store",
"エコノミークラス": "economy class",
"スーパーマーケット": "supermarket",
"アメリカン": "american",
"ドイツ人": "german",
"フランス人": "french",
"イタリア人": "italian",
}
KatakanaWords are words in katakana to quiz.
Functions ¶
func CreateWeights ¶
CreateWeights creates weights for a given set of kana.
func DecreaseWeight ¶
DecreaseWeight decreases the weight for a given value.
func IncreaseWeight ¶
IncreaseWeight increases the weight for a given value.
func ListAddFixedLength ¶
ListAddFixedLength adds a value to a given list
func SelectCount ¶
SelectCount returns the first N elements from a given combined values set.
The selection is mostly random, and predicated on map ordering being random. If this ever changes (map ordering being random) we will need to use random bag pulls.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.