parser

package
v0.0.0-...-9f01711 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Dummy = Algorithm("dummy")
)
View Source
const (
	Rule = Algorithm("rule")
)
View Source
const (
	Statistics = Algorithm("statistics")
)

Variables

View Source
var (
	ErrNameLength       = errors.New("name length needs at least 2 chars")
	ErrSplitPosition    = errors.New("split position is invalid")
	ErrParserNotWorking = errors.New("the name has an unexpected string, so the division failed")
)

Functions

This section is empty.

Types

type Algorithm

type Algorithm string

type DividedName

type DividedName struct {
	FirstName FirstName
	LastName  LastName
	Separator Separator
	Score     float64
	Algorithm Algorithm
}

func (DividedName) IsZero

func (n DividedName) IsZero() bool

func (DividedName) String

func (n DividedName) String() string

type FirstName

type FirstName string

func (FirstName) IsLastName

func (n FirstName) IsLastName() bool

func (FirstName) Length

func (n FirstName) Length() int

func (FirstName) Slice

func (n FirstName) Slice() []rune

type FullName

type FullName string

func JoinName

func JoinName(lastName LastName, firstName FirstName) FullName

func (FullName) Length

func (f FullName) Length() int

func (FullName) Slice

func (f FullName) Slice() []rune

func (FullName) Split

func (f FullName) Split(position int) (LastName, FirstName, error)

type LastName

type LastName string

func (LastName) IsLastName

func (n LastName) IsLastName() bool

func (LastName) Length

func (n LastName) Length() int

func (LastName) Slice

func (n LastName) Slice() []rune

type NameParser

type NameParser struct {
	Parsers   []Parser
	Separator Separator
}

func NewNameParser

func NewNameParser(separatorString Separator, m feature.KanjiFeatureManager) NameParser

func (NameParser) Parse

func (n NameParser) Parse(fullname FullName) (DividedName, error)

type Parser

type Parser interface {
	Parse(fullname FullName, separator Separator) (DividedName, error)
}

type RuleBaseParser

type RuleBaseParser struct {
	// contains filtered or unexported fields
}

func NewRuleBaseParser

func NewRuleBaseParser() RuleBaseParser

type Separator

type Separator string

type StatisticsParser

type StatisticsParser struct {
	OrderCalculator  feature.KanjiOrderFeatureCalculator
	LengthCalculator feature.KanjiLengthFeatureCalculator
}

func (StatisticsParser) Parse

func (s StatisticsParser) Parse(fullname FullName, separator Separator) (DividedName, error)

Jump to

Keyboard shortcuts

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