Documentation ¶
Overview ¶
Package jptools provides a few simple functions for dealing with text in Japanese.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Utf8of map[string]string
Utf8of maps JIS X 0213:2004 codepoints to Unicode codepoints.
Functions ¶
func Convert ¶
Convert returns the unicode string corresponding to the JIS codepoint in the 面-区-点 (men-ku-ten) format. mkt needs to be formatetted as a string of the form "d-dd-dd". err is nil if conversion succeeds.
func MktToJis ¶
MktToJis returns the JIS code point corresponding to the provided 面-区-点 (men-ku-ten) codepoint. mkt needs to be formatetted as a string of the form "d-dd-dd".
func ToHiragana ¶
ToHiragana converts r to hiragana (iff. r is katakana)
func ToKatakana ¶
ToKatakana convers r to katakana (iff. r is hiragana).
Types ¶
type CharTypeID ¶
type CharTypeID int
CharTypeID represents character types.
const ( Symbol CharTypeID = 1 << iota //Symbol captures everything that isn't captured by the other categories. KanNum ArabNumF ArabNum Hiragana Katakana KatakanaH Kanji LatinF Latin )
Define charater types.
func CharType ¶
func CharType(r rune) CharTypeID
CharType returns the character type of r according to the above classification. The Kanji numerals are identified both as Kanji and KanNum using the bitmask KanNum | Kanji.
func (CharTypeID) Name ¶
func (c CharTypeID) Name() string
Name retunrs the character type of c as a string. E.g. "Katakana" if c is katakana.