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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SET_SEPARATOR = "-"
)

Variables

View Source
var (
	ArcAllOut           = false
	TransitionType byte = 'A'
)

Functions

func NewSimpleConfiguration

func NewSimpleConfiguration() Configuration

Types

type ArcCachedDepNode

type ArcCachedDepNode struct {
	Node                nlp.DepNode
	Head, ELabel, ArcId int
	// contains filtered or unexported fields
}

func NewArcCachedDepNode

func NewArcCachedDepNode(from nlp.DepNode) *ArcCachedDepNode

func (*ArcCachedDepNode) AddModifier

func (a *ArcCachedDepNode) AddModifier(mod int, label int, pos int)

func (*ArcCachedDepNode) AllLabelSet

func (a *ArcCachedDepNode) AllLabelSet() interface{}

func (*ArcCachedDepNode) AllModPOS

func (a *ArcCachedDepNode) AllModPOS() interface{}

func (*ArcCachedDepNode) AsString

func (a *ArcCachedDepNode) AsString() string

func (*ArcCachedDepNode) Copy

func (*ArcCachedDepNode) CopyArraySlice

func (a *ArcCachedDepNode) CopyArraySlice(aSrc, aDst *[3]int, sSrc, sDst *[]int)

func (*ArcCachedDepNode) Equal

func (a *ArcCachedDepNode) Equal(otherEq util.Equaler) bool

func (*ArcCachedDepNode) ID

func (a *ArcCachedDepNode) ID() int

func (*ArcCachedDepNode) LRSortedInsertion

func (a *ArcCachedDepNode) LRSortedInsertion(slice *[]int, val int, multiset bool)

func (*ArcCachedDepNode) LeftLabelSet

func (a *ArcCachedDepNode) LeftLabelSet() interface{}

func (*ArcCachedDepNode) LeftMods

func (a *ArcCachedDepNode) LeftMods() []int

func (*ArcCachedDepNode) RightLabelSet

func (a *ArcCachedDepNode) RightLabelSet() interface{}

func (*ArcCachedDepNode) RightMods

func (a *ArcCachedDepNode) RightMods() []int

func (*ArcCachedDepNode) String

func (a *ArcCachedDepNode) String() string

type ArcEager

type ArcEager struct {
	ArcStandard
	POPROOT, REDUCE int
}

func (*ArcEager) AddDefaultOracle

func (a *ArcEager) AddDefaultOracle()

func (*ArcEager) GetTransitions

func (a *ArcEager) GetTransitions(from Configuration) (byte, []int)

func (*ArcEager) Name

func (a *ArcEager) Name() string

func (*ArcEager) Transition

func (a *ArcEager) Transition(from Configuration, rawTransition Transition) Configuration

func (*ArcEager) TransitionTypes

func (a *ArcEager) TransitionTypes() []string

func (*ArcEager) YieldTransitions

func (a *ArcEager) YieldTransitions(from Configuration) (byte, chan int)

type ArcSet

type ArcSet interface {
	Clear()
	Add(nlp.LabeledDepArc)
	Get(nlp.LabeledDepArc) []nlp.LabeledDepArc
	Size() int
	Last() nlp.LabeledDepArc
	Index(int) nlp.LabeledDepArc

	HasHead(int) bool
	HasModifiers(int) bool
	HasArc(int, int) bool

	Copy() ArcSet
	Equal(ArcSet) bool
}

type ArcSetSimple

type ArcSetSimple struct {
	Arcs         []LabeledDepArc
	SeenHead     map[int]bool
	SeenModifier map[int]bool
	SeenArc      map[[2]int]bool
}

func NewArcSetSimple

func NewArcSetSimple(size int) *ArcSetSimple

func NewArcSetSimpleFromGraph

func NewArcSetSimpleFromGraph(graph LabeledDependencyGraph) *ArcSetSimple

func (*ArcSetSimple) Add

func (s *ArcSetSimple) Add(arc LabeledDepArc)

func (*ArcSetSimple) Clear

func (s *ArcSetSimple) Clear()

func (*ArcSetSimple) Copy

func (s *ArcSetSimple) Copy() ArcSet

func (*ArcSetSimple) Diff

func (s *ArcSetSimple) Diff(other ArcSet) (ArcSet, ArcSet)

func (*ArcSetSimple) Equal

func (s *ArcSetSimple) Equal(other ArcSet) bool

func (*ArcSetSimple) Get

func (s *ArcSetSimple) Get(query LabeledDepArc) []LabeledDepArc

func (*ArcSetSimple) HasArc

func (s *ArcSetSimple) HasArc(head, modifier int) bool

func (*ArcSetSimple) HasHead

func (s *ArcSetSimple) HasHead(modifier int) bool

func (*ArcSetSimple) HasModifiers

func (s *ArcSetSimple) HasModifiers(head int) bool

func (*ArcSetSimple) Index

func (s *ArcSetSimple) Index(i int) LabeledDepArc

func (*ArcSetSimple) Last

func (s *ArcSetSimple) Last() LabeledDepArc

func (*ArcSetSimple) Len

func (s *ArcSetSimple) Len() int

func (*ArcSetSimple) Less

func (s *ArcSetSimple) Less(i, j int) bool

func (*ArcSetSimple) Size

func (s *ArcSetSimple) Size() int

func (*ArcSetSimple) Sorted

func (s *ArcSetSimple) Sorted() *ArcSetSimple

func (*ArcSetSimple) String

func (s *ArcSetSimple) String() string

func (*ArcSetSimple) Swap

func (s *ArcSetSimple) Swap(i, j int)

func (*ArcSetSimple) ValueComp

func (s *ArcSetSimple) ValueComp(i, j int, other *ArcSetSimple) int

type ArcStandard

type ArcStandard struct {
	Relations          *util.EnumSet
	Transitions        *util.EnumSet
	SHIFT, LEFT, RIGHT int
	// contains filtered or unexported fields
}

func (*ArcStandard) AddDefaultOracle

func (a *ArcStandard) AddDefaultOracle()

func (*ArcStandard) GetTransitions

func (a *ArcStandard) GetTransitions(from Configuration) (byte, []int)

func (*ArcStandard) Labeled

func (a *ArcStandard) Labeled() bool

func (*ArcStandard) Name

func (a *ArcStandard) Name() string

func (*ArcStandard) Oracle

func (a *ArcStandard) Oracle() Oracle

func (*ArcStandard) Projective

func (a *ArcStandard) Projective() bool

func (*ArcStandard) Transition

func (a *ArcStandard) Transition(from Configuration, rawTransition Transition) Configuration

func (*ArcStandard) TransitionTypes

func (a *ArcStandard) TransitionTypes() []string

func (*ArcStandard) YieldTransitions

func (a *ArcStandard) YieldTransitions(from Configuration) (byte, chan int)

type ArcStandardOracle

type ArcStandardOracle struct {
	LA, RA      int
	Transitions *util.EnumSet
	// contains filtered or unexported fields
}

func (*ArcStandardOracle) Name

func (o *ArcStandardOracle) Name() string

func (*ArcStandardOracle) SetGold

func (o *ArcStandardOracle) SetGold(g interface{})

func (*ArcStandardOracle) Transition

func (o *ArcStandardOracle) Transition(conf Configuration) Transition

type BasicDepArc

type BasicDepArc struct {
	Head        int
	Relation    int
	Modifier    int
	RawRelation nlp.DepRel
}

func (*BasicDepArc) Equal

func (arc *BasicDepArc) Equal(otherEq util.Equaler) bool

func (*BasicDepArc) From

func (arc *BasicDepArc) From() int

func (*BasicDepArc) GetHead

func (arc *BasicDepArc) GetHead() int

func (*BasicDepArc) GetModifier

func (arc *BasicDepArc) GetModifier() int

func (*BasicDepArc) GetRelation

func (arc *BasicDepArc) GetRelation() nlp.DepRel

func (*BasicDepArc) ID

func (arc *BasicDepArc) ID() int

func (*BasicDepArc) String

func (arc *BasicDepArc) String() string

func (*BasicDepArc) To

func (arc *BasicDepArc) To() int

func (*BasicDepArc) Vertices

func (arc *BasicDepArc) Vertices() []int

type BasicDepGraph

type BasicDepGraph struct {
	Nodes []nlp.DepNode
	Arcs  []*BasicDepArc
}

func (*BasicDepGraph) Equal

func (g *BasicDepGraph) Equal(otherEq util.Equaler) bool

func (*BasicDepGraph) GetArc

func (g *BasicDepGraph) GetArc(n int) nlp.DepArc

func (*BasicDepGraph) GetDirectedEdge

func (g *BasicDepGraph) GetDirectedEdge(n int) graph.DirectedEdge

func (*BasicDepGraph) GetEdge

func (g *BasicDepGraph) GetEdge(n int) graph.Edge

func (*BasicDepGraph) GetEdges

func (g *BasicDepGraph) GetEdges() []int

func (*BasicDepGraph) GetLabeledArc

func (g *BasicDepGraph) GetLabeledArc(n int) nlp.LabeledDepArc

func (*BasicDepGraph) GetNode

func (g *BasicDepGraph) GetNode(n int) nlp.DepNode

func (*BasicDepGraph) GetVertex

func (g *BasicDepGraph) GetVertex(n int) graph.Vertex

func (*BasicDepGraph) GetVertices

func (g *BasicDepGraph) GetVertices() []int

func (*BasicDepGraph) NumberOfArcs

func (g *BasicDepGraph) NumberOfArcs() int

func (*BasicDepGraph) NumberOfEdges

func (g *BasicDepGraph) NumberOfEdges() int

func (*BasicDepGraph) NumberOfNodes

func (g *BasicDepGraph) NumberOfNodes() int

func (*BasicDepGraph) NumberOfVertices

func (g *BasicDepGraph) NumberOfVertices() int

func (*BasicDepGraph) Sentence

func (g *BasicDepGraph) Sentence() nlp.Sentence

func (*BasicDepGraph) StringEdges

func (g *BasicDepGraph) StringEdges() string

func (*BasicDepGraph) TaggedSentence

func (g *BasicDepGraph) TaggedSentence() nlp.TaggedSentence

type DependencyConfiguration

type DependencyConfiguration interface {
	transition.Configuration
	Graph() nlp.LabeledDependencyGraph
}

type NoCandidate

type NoCandidate struct{}

func (*NoCandidate) Copy

func (c *NoCandidate) Copy() search.Candidate

func (*NoCandidate) Equal

func (c *NoCandidate) Equal(other search.Candidate) bool

func (*NoCandidate) Len

func (c *NoCandidate) Len() int

func (*NoCandidate) Score

func (c *NoCandidate) Score() float64

func (*NoCandidate) Terminal

func (c *NoCandidate) Terminal() bool

type SimpleConfiguration

type SimpleConfiguration struct {
	InternalStack    Stack
	InternalQueue    Queue
	InternalArcs     ArcSet
	Nodes            []*ArcCachedDepNode
	InternalPrevious *SimpleConfiguration
	Last             Transition

	// Pointers                                           int
	EWord, EPOS, EWPOS, EMHost, EMSuffix, ERel, ETrans *util.EnumSet
	// test zpar parity
	NumHeadStack  int
	TerminalQueue int
	TerminalStack int
	// contains filtered or unexported fields
}

func (*SimpleConfiguration) AddArc

func (c *SimpleConfiguration) AddArc(arc *BasicDepArc)

func (*SimpleConfiguration) Address

func (c *SimpleConfiguration) Address(location []byte, sourceOffset int) (int, bool, bool)

func (*SimpleConfiguration) Arcs

func (c *SimpleConfiguration) Arcs() ArcSet

func (*SimpleConfiguration) Assign

func (c *SimpleConfiguration) Assign(to uint16)

func (*SimpleConfiguration) Assignment

func (c *SimpleConfiguration) Assignment() uint16

func (*SimpleConfiguration) Attribute

func (c *SimpleConfiguration) Attribute(source byte, nodeID int, attribute []byte, transitions []int) (att interface{}, exists bool, isGen bool)

func (*SimpleConfiguration) Clear

func (c *SimpleConfiguration) Clear()

func (*SimpleConfiguration) Copy

func (c *SimpleConfiguration) Copy() Configuration

func (*SimpleConfiguration) CopyTo

func (c *SimpleConfiguration) CopyTo(target Configuration)

func (*SimpleConfiguration) Equal

func (c *SimpleConfiguration) Equal(otherEq util.Equaler) bool

func (*SimpleConfiguration) GenerateAddresses

func (c *SimpleConfiguration) GenerateAddresses(nodeID int, location []byte) (nodeIDs []int)

func (*SimpleConfiguration) GetArc

func (c *SimpleConfiguration) GetArc(nodeID int) nlp.DepArc

func (*SimpleConfiguration) GetConfDistance

func (c *SimpleConfiguration) GetConfDistance() (int, bool, bool)

func (*SimpleConfiguration) GetDirectedEdge

func (c *SimpleConfiguration) GetDirectedEdge(edgeID int) graph.DirectedEdge

func (*SimpleConfiguration) GetEdge

func (c *SimpleConfiguration) GetEdge(edgeID int) graph.Edge

func (*SimpleConfiguration) GetEdges

func (c *SimpleConfiguration) GetEdges() []int

func (*SimpleConfiguration) GetHead

func (c *SimpleConfiguration) GetHead(nodeID int) (*ArcCachedDepNode, bool)

func (*SimpleConfiguration) GetLabeledArc

func (c *SimpleConfiguration) GetLabeledArc(nodeID int) nlp.LabeledDepArc

func (*SimpleConfiguration) GetLastTransition

func (c *SimpleConfiguration) GetLastTransition() Transition

func (*SimpleConfiguration) GetModifierLabel

func (c *SimpleConfiguration) GetModifierLabel(modifierID int) (int, bool, bool)

func (*SimpleConfiguration) GetModifierLabelSets

func (c *SimpleConfiguration) GetModifierLabelSets(nodeID int) (interface{}, interface{}, interface{})

func (*SimpleConfiguration) GetModifiers

func (c *SimpleConfiguration) GetModifiers(nodeID int) ([]int, []int)

func (*SimpleConfiguration) GetModifiersPOS

func (c *SimpleConfiguration) GetModifiersPOS(nodeID int) interface{}

func (*SimpleConfiguration) GetNode

func (c *SimpleConfiguration) GetNode(nodeID int) nlp.DepNode

func (*SimpleConfiguration) GetNumModifiers

func (c *SimpleConfiguration) GetNumModifiers(nodeID int) (int, int)

func (*SimpleConfiguration) GetRawNode

func (c *SimpleConfiguration) GetRawNode(nodeID int) *TaggedDepNode

func (*SimpleConfiguration) GetSequence

func (c *SimpleConfiguration) GetSequence() ConfigurationSequence

func (*SimpleConfiguration) GetSource

func (c *SimpleConfiguration) GetSource(location byte) Index

func (*SimpleConfiguration) GetVertex

func (c *SimpleConfiguration) GetVertex(vertexID int) graph.Vertex

func (*SimpleConfiguration) GetVertices

func (c *SimpleConfiguration) GetVertices() []int

GRAPH FUNCTIONS

func (*SimpleConfiguration) Graph

func (*SimpleConfiguration) ID

func (c *SimpleConfiguration) ID() int

func (*SimpleConfiguration) Init

func (c *SimpleConfiguration) Init(abstractSentence interface{})

func (*SimpleConfiguration) Len

func (c *SimpleConfiguration) Len() int

func (*SimpleConfiguration) NumberOfArcs

func (c *SimpleConfiguration) NumberOfArcs() int

func (*SimpleConfiguration) NumberOfEdges

func (c *SimpleConfiguration) NumberOfEdges() int

func (*SimpleConfiguration) NumberOfNodes

func (c *SimpleConfiguration) NumberOfNodes() int

func (*SimpleConfiguration) NumberOfVertices

func (c *SimpleConfiguration) NumberOfVertices() int

func (*SimpleConfiguration) Previous

func (c *SimpleConfiguration) Previous() Configuration

func (*SimpleConfiguration) Queue

func (c *SimpleConfiguration) Queue() Queue

func (*SimpleConfiguration) Sentence

func (c *SimpleConfiguration) Sentence() nlp.Sentence

func (*SimpleConfiguration) SetLastTransition

func (c *SimpleConfiguration) SetLastTransition(t Transition)

func (*SimpleConfiguration) SetPrevious

func (c *SimpleConfiguration) SetPrevious(prev Configuration)

func (*SimpleConfiguration) Stack

func (c *SimpleConfiguration) Stack() Stack

func (*SimpleConfiguration) State

func (c *SimpleConfiguration) State() byte

func (*SimpleConfiguration) String

func (c *SimpleConfiguration) String() string

func (*SimpleConfiguration) StringArcs

func (c *SimpleConfiguration) StringArcs() string

func (*SimpleConfiguration) StringGraph

func (c *SimpleConfiguration) StringGraph() string

func (*SimpleConfiguration) StringQueue

func (c *SimpleConfiguration) StringQueue() string

func (*SimpleConfiguration) StringStack

func (c *SimpleConfiguration) StringStack() string

func (*SimpleConfiguration) TaggedSentence

func (c *SimpleConfiguration) TaggedSentence() nlp.TaggedSentence

func (*SimpleConfiguration) Terminal

func (c *SimpleConfiguration) Terminal() bool

type TaggedDepNode

type TaggedDepNode struct {
	Id       int
	Token    int
	POS      int
	TokenPOS int
	MHost    int
	MSuffix  int
	RawToken string
	RawLemma string
	RawPOS   string
}

func (*TaggedDepNode) Equal

func (t *TaggedDepNode) Equal(otherEq util.Equaler) bool

func (*TaggedDepNode) ID

func (t *TaggedDepNode) ID() int

func (*TaggedDepNode) String

func (t *TaggedDepNode) String() string

type VarBeam

type VarBeam struct {
	search.Beam
}

func (*VarBeam) GoalTest

func (v *VarBeam) GoalTest(p search.Problem, c search.Candidate, rounds int) bool

func (*VarBeam) Top

func (v *VarBeam) Top(a search.Agenda) search.Candidate

type ZparArcEagerOracle

type ZparArcEagerOracle struct {
	ArcStandardOracle
	Transitions *util.EnumSet
	LA, RA      int
}

func (*ZparArcEagerOracle) Name

func (o *ZparArcEagerOracle) Name() string

func (*ZparArcEagerOracle) Transition

func (o *ZparArcEagerOracle) Transition(conf Configuration) Transition

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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