kana

package
v0.0.0-...-bc49051 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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

func CreateWeights(values map[string]string) map[string]float64

CreateWeights creates weights for a given set of kana.

func DecreaseWeight

func DecreaseWeight(weights map[string]float64, key string)

DecreaseWeight decreases the weight for a given value.

func IncreaseWeight

func IncreaseWeight(weights map[string]float64, key string)

IncreaseWeight increases the weight for a given value.

func ListAddFixedLength

func ListAddFixedLength(list []string, value string, max int) []string

ListAddFixedLength adds a value to a given list

func ListHas

func ListHas(list []string, value string) bool

ListHas returns if a value is present in a list

func Merge

func Merge(sets ...map[string]string) map[string]string

Merge merges variadic sets of values.

func SelectCount

func SelectCount(values map[string]string, count int) map[string]string

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.

func SelectWeighted

func SelectWeighted(values map[string]string, weights map[string]float64) (kana, roman string)

SelectWeighted selects a kana and a roman from a given set of values and weights.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL