kana

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(formName string, writer io.Writer, txt io.Reader, foldFlag bool) error

Convert function converts kana character in text stream.

func ConvertString

func ConvertString(formName string, txt string, foldFlag bool) (string, error)

ConvertString function converts kana character in text string.

Example
package main

import (
	"fmt"

	"github.com/spiegel-im-spiegel/gnkf/kana"
)

func main() {
	txt := "あいうえおわゐゑをんゔゕゖゝゞアイウエオワヰヱヲンヴヵヶヽヾ"
	str, err := kana.ConvertString("hiragana", txt, false)
	if err != nil {
		return
	}
	fmt.Println(str)
	str, err = kana.ConvertString("katakana", txt, false)
	if err != nil {
		return
	}
	fmt.Println(str)
	str, err = kana.ConvertString("chokuon", txt, false)
	if err != nil {
		return
	}
	fmt.Println(str)
}
Output:

あいうえおわゐゑをんゔゕゖゝゞあいうえおわゐゑをんゔゕゖゝゞ
アイウエオワヰヱヲンヴヵヶヽヾアイウエオワヰヱヲンヴヵヶヽヾ
あいうえおわゐゑをんゔかけゝゞアイウエオワヰヱヲンヴカケヽヾ

func FormList

func FormList() []string

FormList returns list of newline form

func ReplaceChokuon

func ReplaceChokuon(txt string) string

ReplaceChokuon replaces chokuon (upper kana case).

func ReplaceHiragana

func ReplaceHiragana(txt string) string

ReplaceHiragana replaces hiragana from katrakana (full-width kana kcharacter only).

func ReplaceKatakana

func ReplaceKatakana(txt string) string

ReplaceKatakana replaces katakana from hiragana (full-width kana kcharacter only).

func ReplaceYouon

func ReplaceYouon(txt string) string

ReplaceYouon replaces youon (lower kana case).

Types

type Form

type Form int

Form is type of newline form

const (
	Hiragana Form = iota //Hiragana form
	Katakana             //Katakana form
	Chokuon              //Chokuon (Upper kana) form
)

func FormOf

func FormOf(name string) (Form, error)

FormOf returns newline form name string

Jump to

Keyboard shortcuts

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