feature

package
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: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CharacterFeatureSize    = 1
	OrderFeatureSize        = 6
	LengthFeatureSize       = 8
	OrderFirstFeatureIndex  = OrderFeatureIndexPosition(0)
	OrderMiddleFeatureIndex = OrderFeatureIndexPosition(1)
	OrderEndFeatureIndex    = OrderFeatureIndexPosition(2)
)

Variables

View Source
var (
	ErrOrderFeatureInvalidSize  = errors.New("order feature's length must be 6")
	ErrLengthFeatureInvalidSize = errors.New("length feature's length must be 8")
	ErrInvalidFeatureSize       = errors.New("feature-to-feature calculations must be the same size")
	ErrOutRangeOrderMask        = errors.New("character position is out of range when creating mask")
	ErrInvalidOrderMask         = errors.New("first character and last character must not be created order mask")
	ErrOutRangeFeatureIndex     = errors.New("character position is out of range when selecting features")
)

Functions

This section is empty.

Types

type Character

type Character string

type Features

type Features []float64

func (Features) Multiple

func (f Features) Multiple(mask Features) (Features, error)

func (Features) SoftMax

func (f Features) SoftMax() Features

func (Features) Sum

func (f Features) Sum() float64

type KanjiFeature

type KanjiFeature struct {
	Character Character
	Order     Features
	Length    Features
}

func DefaultKanjiFeature

func DefaultKanjiFeature() KanjiFeature

func NewKanjiFeature

func NewKanjiFeature(c Character, o, l []float64) (KanjiFeature, error)

func (KanjiFeature) GetLengthValue

func (k KanjiFeature) GetLengthValue(p LengthFeatureIndexPosition, mask Features) (float64, error)

func (KanjiFeature) GetOrderValue

func (k KanjiFeature) GetOrderValue(p OrderFeatureIndexPosition, mask Features) (float64, error)

type KanjiFeatureManager

type KanjiFeatureManager struct {
	KanjiFeatureMap map[Character]KanjiFeature
}

func (KanjiFeatureManager) Get

func (KanjiFeatureManager) LengthMask

func (m KanjiFeatureManager) LengthMask(fullNameLength, charPosition int) (Features, error)

func (KanjiFeatureManager) OrderMask

func (m KanjiFeatureManager) OrderMask(fullNameLength, charPosition int) (Features, error)

func (KanjiFeatureManager) SelectLengthFeaturePosition

func (m KanjiFeatureManager) SelectLengthFeaturePosition(pieceOfName PartOfNameCharacters) (LengthFeatureIndexPosition, error)

func (KanjiFeatureManager) SelectOrderFeaturePosition

func (m KanjiFeatureManager) SelectOrderFeaturePosition(pieceOfName PartOfNameCharacters, positionInPieceOfName int) (OrderFeatureIndexPosition, error)

type KanjiLengthFeatureCalculator

type KanjiLengthFeatureCalculator struct {
	Manager KanjiFeatureManager
}

func (KanjiLengthFeatureCalculator) Score

func (fc KanjiLengthFeatureCalculator) Score(pieceOfName PartOfNameCharacters, fullNameLength int) (float64, error)

type KanjiOrderFeatureCalculator

type KanjiOrderFeatureCalculator struct {
	Manager KanjiFeatureManager
}

func (KanjiOrderFeatureCalculator) Score

func (fc KanjiOrderFeatureCalculator) Score(pieceOfName PartOfNameCharacters, fullNameLength int) (float64, error)

type LengthFeatureIndexPosition

type LengthFeatureIndexPosition int

func (LengthFeatureIndexPosition) MoveFirstNameIndex

type OrderFeatureIndexPosition

type OrderFeatureIndexPosition int

func (OrderFeatureIndexPosition) MoveFirstNameIndex

type PartOfNameCharacters

type PartOfNameCharacters interface {
	Length() int
	Slice() []rune
	IsLastName() bool
}

Jump to

Keyboard shortcuts

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