seimei

package module
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 11 Imported by: 1

README

seimei

MIT License test reviewdog

seimei is a Go port of a tool (namedivider-python) created in python to split Japanese first and last names.

For implementation details, please check (namedivider-python) from which porting.

Installation

go install github.com/glassmonkey/seimei/v2/cmd/seimei@latest

Usage

Options

$ seimei -h
Usage:
  seimei [flags]
  seimei [command]

Available Commands:
  name        It parse single full name.
  file        It bulk parse full name lit in the file.
  help        Help about any command

Flags:
  -h, --help      help for seimei
  -v, --version   version for seimei

Use "seimei [command] --help" for more information about a command

Example

$ seimei name --name 竈門炭治郎
竈門 炭治郎

$ seimei name --name 竈門禰豆子 --parse @
竈門@禰豆子
$ cat /tmp/kimetsu.txt
竈門炭治郎
竈門禰豆子
我妻善逸
嘴平伊之助

$ seimei file --file /tmp/kimetsu.txt
竈門 炭治郎
竈門 禰豆子
我妻 善逸
嘴平 伊之助

$ seimei file --file /tmp/kimetsu.txt --parse @
竈門@炭治郎
竈門@禰豆子
我妻@善逸
嘴平@伊之助

License

Mit

Author

glassmonkey(@glassmonekey)

Documentation

Index

Constants

View Source
const (
	NameCmd     CmdMode = "name"
	FileCmd     CmdMode = "file"
	ParseOption string  = "parse"
)

Variables

View Source
var (
	//go:embed version.txt
	VersionText           string
	ErrEmptyName          = errors.New("provide name is empty (ex. 田中太郎)")
	ErrInvalidName        = errors.New("provide path is invalid")
	ErrEmptyPath          = errors.New("provide path is empty (ex. /tmp/foo.csv)")
	ErrInvalidPath        = errors.New("provide path is invalid")
	ErrInvalidParseString = errors.New("provide parse string is invalid")
)

Functions

func BuildFileCmd

func BuildFileCmd() *cobra.Command

func BuildMainCmd

func BuildMainCmd() *cobra.Command

func BuildNameCmd

func BuildNameCmd() *cobra.Command

func InitKanjiFeatureManager

func InitKanjiFeatureManager() feature.KanjiFeatureManager

func InitNameParser

func InitNameParser(parseString ParseString, manager feature.KanjiFeatureManager) parser.NameParser

func InitReader

func InitReader(path Path) (*csv.Reader, error)

func ParseFile

func ParseFile(out, stderr io.Writer, path Path, parseString ParseString) error

func ParseName

func ParseName(out, stderr io.Writer, fullname Name, parseString ParseString) error

func Run

func Run() error

Types

type CmdMode

type CmdMode string

func (CmdMode) String

func (c CmdMode) String() string

type Name

type Name string

type ParseString

type ParseString string

type Path

type Path string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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