transition

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FEATURE_SEPARATOR              = "+" // separates multiple attribute sources
	ATTRIBUTE_SEPARATOR            = "|" // separates attributes in a source
	TEMPLATE_PREFIX                = ":" // output separator
	GENERIC_SEPARATOR              = "|" // output separator
	FEATURE_REQUIREMENTS_SEPARATOR = "," // separates template from requirements
	REQUIREMENTS_SEPARATOR         = ";" // separates multiple requirements
	APPROX_ELEMENTS                = 20
	ALLOW_IDLE                     = true
)

Variables

View Source
var IDLE = &TypedTransition{'I', 0}
View Source
var (
	S0R2l, S0Rl int = -1, -1
)

Functions

func GetArray

func GetArray(input []interface{}) interface{}

func GetArrayInt

func GetArrayInt(input []int) interface{}

Types

type Configuration

type Configuration interface {
	Init(interface{})
	Terminal() bool

	Copy() Configuration
	CopyTo(Configuration)
	Clear()

	Len() int
	Previous() Configuration
	SetPrevious(Configuration)
	GetSequence() ConfigurationSequence
	SetLastTransition(Transition)
	GetLastTransition() Transition
	String() string
	Equal(otherEq util.Equaler) bool

	Address(location []byte, offset int) (nodeID int, exists bool, isGenerator bool)
	GenerateAddresses(nodeID int, location []byte) (nodeIDs []int)
	Attribute(source byte, nodeID int, attribute []byte, transitions []int) (attributeValue interface{}, exists bool, isGenerator bool)

	Assignment() uint16

	State() byte
}

type ConfigurationSequence

type ConfigurationSequence []Configuration

func (ConfigurationSequence) Equal

func (seq ConfigurationSequence) Equal(otherEq util.Equaler) bool

func (ConfigurationSequence) SharedTransitions

func (seq ConfigurationSequence) SharedTransitions(other ConfigurationSequence) int

func (ConfigurationSequence) String

func (seq ConfigurationSequence) String() string

type ConstTransition

type ConstTransition int

func (ConstTransition) Equal

func (b ConstTransition) Equal(other Transition) bool

func (ConstTransition) Type

func (b ConstTransition) Type() byte

func (ConstTransition) Value

func (b ConstTransition) Value() int

type Decision

type Decision interface {
	Transition(Configuration) Transition
}

type FeatureGroup

type FeatureGroup struct {
	Group      string
	Transition string
	Features   []string
	Idle       bool
	Associated bool
}

type FeatureSetup

type FeatureSetup struct {
	FeatureGroups  []FeatureGroup  `yaml:"feature groups"`
	MorphTemplates []MorphTemplate `yaml:"morph templates"`
}

func LoadFeatureConf

func LoadFeatureConf(conf []byte) *FeatureSetup

func LoadFeatureConfFile

func LoadFeatureConfFile(filename string) (*FeatureSetup, error)

func (*FeatureSetup) NumFeatures

func (s *FeatureSetup) NumFeatures() int

type FeatureTemplate

type FeatureTemplate struct {
	Elements                                   []FeatureTemplateElement
	Requirements                               []string
	ID                                         int
	CachedElementIDs                           []int // where to find the feature elements of the template in the cache
	CachedReqIDs                               []int // cached address required to exist for element
	EWord, EPOS, EWPOS, ERel, EMHost, EMSuffix *util.EnumSet
	EMorphProp, EToken                         *util.EnumSet
	TransitionType                             string
	Associated                                 bool
}

func (FeatureTemplate) Format

func (f FeatureTemplate) Format(val interface{}) string

func (FeatureTemplate) FormatWithGenerator

func (f FeatureTemplate) FormatWithGenerator(val interface{}, isGenerator bool) string

func (FeatureTemplate) String

func (f FeatureTemplate) String() string

type FeatureTemplateElement

type FeatureTemplateElement struct {
	Address    []byte
	Offset     int
	Attributes [][]byte

	ConfStr     string
	IsGenerator bool
}

type FeaturesList

type FeaturesList struct {
	Features   []Feature
	Transition Transition
	Previous   *FeaturesList
}

func (*FeaturesList) String

func (l *FeaturesList) String() string

type GenericExtractor

type GenericExtractor struct {
	EFeatures *util.EnumSet

	TransTypeGroups map[byte]*TransTypeGroup

	Concurrent bool

	Log                                                bool
	EWord, EPOS, EWPOS, ERel, EMHost, EMSuffix, EToken *util.EnumSet
	EMorphProp                                         *util.EnumSet
	POPTrans                                           Transition
}

func (*GenericExtractor) EstimatedNumberOfFeatures

func (x *GenericExtractor) EstimatedNumberOfFeatures() int

func (*GenericExtractor) Features

func (x *GenericExtractor) Features(instance Instance, idle bool, transType byte, transitions []int) []Feature

func (*GenericExtractor) GetFeature

func (x *GenericExtractor) GetFeature(conf Configuration, template FeatureTemplate, featureValues, attrValues []interface{}) (interface{}, bool)

func (*GenericExtractor) GetFeatureElement

func (x *GenericExtractor) GetFeatureElement(conf Configuration, templateElement *FeatureTemplateElement, attrValues []interface{}, transitions []int) (interface{}, bool, bool)

func (*GenericExtractor) Init

func (x *GenericExtractor) Init()

func (*GenericExtractor) InitTypes

func (x *GenericExtractor) InitTypes(transTypes []byte)

func (*GenericExtractor) LoadFeature

func (x *GenericExtractor) LoadFeature(featTemplateStr string, requirements string, transitionType string, idle, associated bool) error

func (*GenericExtractor) LoadFeatureSetup

func (x *GenericExtractor) LoadFeatureSetup(setup *FeatureSetup)

func (*GenericExtractor) LoadFeatures

func (x *GenericExtractor) LoadFeatures(reader io.Reader) error

func (*GenericExtractor) ParseFeatureElement

func (x *GenericExtractor) ParseFeatureElement(featElementStr string) (*FeatureTemplateElement, error)

func (*GenericExtractor) ParseFeatureTemplate

func (x *GenericExtractor) ParseFeatureTemplate(featTemplateStr string, requirements string) (*FeatureTemplate, error)

func (*GenericExtractor) ParseMorphConfiguration

func (x *GenericExtractor) ParseMorphConfiguration(morphTemplateStr string) *MorphElement

func (*GenericExtractor) SetLog

func (x *GenericExtractor) SetLog(val bool)

func (*GenericExtractor) UpdateFeatureElementCache

func (x *GenericExtractor) UpdateFeatureElementCache(feat *FeatureTemplate, idle bool)

type MorphElement

type MorphElement struct {
	MorphType      string
	ElementAddress int
}

type MorphTemplate

type MorphTemplate struct {
	Group        string
	Combinations []string
}

type Oracle

type Oracle interface {
	Decision
	SetGold(interface{})
	Name() string
}

type TransTypeGroup

type TransTypeGroup struct {
	FeatureTemplates []FeatureTemplate
	ElementEnum      *util.EnumSet
	Elements         []FeatureTemplateElement
}

type Transition

type Transition interface {
	Type() byte
	Value() int
	Equal(other Transition) bool
}

type TransitionSystem

type TransitionSystem interface {
	Transition(from Configuration, transition Transition) Configuration

	TransitionTypes() []string

	YieldTransitions(conf Configuration) (transType byte, transitions chan int)
	GetTransitions(conf Configuration) (transType byte, transitions []int)

	Oracle() Oracle
	AddDefaultOracle()

	Name() string
}

type TypedTransition

type TypedTransition struct {
	T byte
	V int
}

func (*TypedTransition) Equal

func (t *TypedTransition) Equal(other Transition) bool

func (*TypedTransition) Type

func (t *TypedTransition) Type() byte

func (*TypedTransition) Value

func (t *TypedTransition) Value() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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