app

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

Documentation

Index

Constants

View Source
const (
	NUM_CPUS_FLAG = "cpus"
	VERSION       = "0.0.0.2"
)
View Source
const (
	APPROX_MORPH_TRANSITIONS        = 100
	APPROX_WORDS, APPROX_POS        = 100, 100
	WORDS_POS_FACTOR                = 5
	APPROX_MHOSTS, APPROX_MSUFFIXES = 128, 16
)

An approximation of the number of different MD-X:Y:Z transitions Pre-allocating the enumeration saves frequent reallocation during training and parsing

Variables

View Source
var (
	CPUs       int
	CPUProfile string
)
View Source
var (

	// processing options
	Iterations, BeamSize int
	DepBeamSize          int
	ConcurrentBeam       bool
	NumFeatures          int
	UsePOP               bool

	// global enumerations
	ERel, ETrans, EWord, EPOS, EWPOS, EMHost, EMSuffix *util.EnumSet
	ETokens                                            *util.EnumSet
	EMorphProp                                         *util.EnumSet

	// enumeration offsets of transitions
	SH, RE, PR, LA, RA, IDLE, POP, MD transition.Transition

	AlignBeam     bool
	AverageScores bool

	// string arrays can't be const, so let it be a var
	DEFAULT_MODEL_DIRS = []string{".", "data"}
	DEFAULT_CONF_DIRS  = []string{".", "conf"}
)
View Source
var AppCommands []*commander.Command = []*commander.Command{

	DepCmd(),
	MdCmd(),
	JointCmd(),
	MALearnCmd(),
	MACmd(),
	HebMACmd(),
}
View Source
var (
	DEFAULT_DATA_DIRS = []string{".", "data/bgulex"}
)
View Source
var (
	JointStrategy, OracleStrategy string
)
View Source
var (
	UseWB bool
)

Functions

func AllCommands

func AllCommands() *commander.Command

func CombineJointCorpus

func CombineJointCorpus(graphs, goldLats, ambLats []interface{}) ([]interface{}, int)

func CombineLatticesCorpus

func CombineLatticesCorpus(goldLats, ambLats []interface{}) ([]interface{}, int, int, int)

func CombineToGoldMorph

func CombineToGoldMorph(goldLat, ambLat nlp.LatticeSentence) (m *disambig.MDConfig, spelloutsAdded int)

func CombineToGoldMorphs

func CombineToGoldMorphs(goldLats, ambLats []interface{}) ([]interface{}, int)

func DepCmd added in v1.1.0

func DepCmd() *commander.Command

func DepConfigOut added in v1.1.0

func DepConfigOut(outModelFile string, b search.Interface, t transition.TransitionSystem)

func DepEval

func DepEval(test, gold interface{}) *eval.Result

Assumes sorted inputs of equal length

func DepEvalCmd

func DepEvalCmd() *commander.Command

func DepEvalConfigOut

func DepEvalConfigOut()

func DepEvalConll

func DepEvalConll(test, gold interface{}) *eval.Result

Assumes sorted inputs of equal length

func DepEvalTrainAndParse

func DepEvalTrainAndParse(cmd *commander.Command, args []string) error

func DepTrainAndParse added in v1.1.0

func DepTrainAndParse(cmd *commander.Command, args []string) error

func EstimatedBeamTransitions

func EstimatedBeamTransitions() int

func GenLemmas

func GenLemmas(cmd *commander.Command, args []string) error

func GenLemmasCmd

func GenLemmasCmd() *commander.Command

func GenLemmasConfigOut

func GenLemmasConfigOut()

func GenSegSequence

func GenSegSequence(iAmbLat, iGoldLat interface{}) nlp.LatticeSentence

func GenSegSequences

func GenSegSequences(ambLats, goldLats []interface{}) []nlp.LatticeSentence

func GenUnAmbLemmas

func GenUnAmbLemmas(cmd *commander.Command, args []string) error

func GenUnAmbLemmasCmd

func GenUnAmbLemmasCmd() *commander.Command

func GenUnAmbLemmasConfigOut

func GenUnAmbLemmasConfigOut()

func GetAsLabeledDepGraph

func GetAsLabeledDepGraph(instance interface{}) util.Equaler

func GetAsTaggedSentence

func GetAsTaggedSentence(instance interface{}) util.Equaler

func GetInstances

func GetInstances(instances []interface{}, getFunc InstanceFunc) []interface{}

func GetJointMDConfig

func GetJointMDConfig(instance interface{}) util.Equaler

func GetLemmas

func GetLemmas(conf *disambig.MDConfig, pf nlp.MDParam) nlp.AmbMorphs

func GetLemmasCorpus

func GetLemmasCorpus(goldSequences []*disambig.MDConfig, rawSents []nlp.BasicSentence, pf nlp.MDParam)

func GetMDConfigAsLattices

func GetMDConfigAsLattices(instance interface{}) util.Equaler

func GetMDConfigAsMappings

func GetMDConfigAsMappings(instance interface{}) util.Equaler

func GetMorphGraph

func GetMorphGraph(instance interface{}) util.Equaler

func GetMorphGraphAsLattices

func GetMorphGraphAsLattices(instance interface{}) util.Equaler

func GetUnAmbLemmas

func GetUnAmbLemmas(conf *disambig.MDConfig, pf nlp.MDParam) nlp.DisAmbMorphs

func GetUnAmbLemmasCorpus

func GetUnAmbLemmasCorpus(goldSequences []*disambig.MDConfig, rawSents []nlp.BasicSentence, pf nlp.MDParam)

func GoldSeg

func GoldSeg(cmd *commander.Command, args []string) error

func GoldSegCmd

func GoldSegCmd() *commander.Command

func GoldSegConfigOut

func GoldSegConfigOut()

func HebMA

func HebMA(cmd *commander.Command, args []string) error

func HebMACmd

func HebMACmd() *commander.Command

func HebMAConfigOut

func HebMAConfigOut()

func InitCommand

func InitCommand(cmd *commander.Command, args []string)

func JointCmd

func JointCmd() *commander.Command

func JointConfigOut

func JointConfigOut(outModelFile string, b search.Interface, t transition.TransitionSystem)

func JointEval

func JointEval(test, gold interface{}, metric string) *eval.Result

Assumes sorted inputs of equal length

func JointTrainAndParse

func JointTrainAndParse(cmd *commander.Command, args []string) error

func Limit

func Limit(instances []interface{}, limit int) []interface{}

func MA

func MA(cmd *commander.Command, args []string) error

func MACmd

func MACmd() *commander.Command

func MAConfigOut

func MAConfigOut()

func MALearn

func MALearn(cmd *commander.Command, args []string) error

func MALearnCmd

func MALearnCmd() *commander.Command

func MALearnConfigOut

func MALearnConfigOut()

func MDConfigOut

func MDConfigOut(outModelFile string, b search.Interface, t transition.TransitionSystem)

func MDTrainAndParse

func MDTrainAndParse(cmd *commander.Command, args []string) error

func MakeDepEvalStopCondition

func MakeDepEvalStopCondition(instances []interface{}, goldInstances []interface{}, testInstances []interface{}, parser Parser, goldDecoder perceptron.InstanceDecoder, beamSize int) perceptron.StopCondition

func MakeJointEvalStopCondition

func MakeJointEvalStopCondition(instances []interface{}, goldInstances []interface{}, testInstances []interface{}, testGoldInstances []interface{}, parser Parser, goldDecoder perceptron.InstanceDecoder, beamSize int) perceptron.StopCondition

func MakeMorphEvalStopCondition

func MakeMorphEvalStopCondition(instances []interface{}, goldInstances []interface{}, testInstances []interface{}, testGoldInstances []interface{}, parser Parser, goldDecoder perceptron.InstanceDecoder, beamSize int) perceptron.StopCondition

func MdCmd

func MdCmd() *commander.Command

func MorphEval

func MorphEval(test, gold interface{}, metric string) *eval.Result

Assumes sorted inputs of equal length

func NewAppWrapCommand

func NewAppWrapCommand(f func(cmd *commander.Command, args []string) error) func(cmd *commander.Command, args []string) error

func Parse

func Parse(instances []interface{}, parser Parser) []interface{}

func SetupDepEnum added in v1.1.0

func SetupDepEnum(relations []string)

func SetupEnum

func SetupEnum(relations []string)

func SetupEvalEnum

func SetupEvalEnum(relations []string)

func SetupExtractor

func SetupExtractor(setup *transition.FeatureSetup, transTypes []byte) *transition.GenericExtractor

func SetupMDEnum

func SetupMDEnum()

func SetupMorphTransEnum

func SetupMorphTransEnum(relations []string)

func SetupRelationEnum

func SetupRelationEnum(labels []string)

func SetupTransEnum

func SetupTransEnum(relations []string)

func Train

func Train(trainingSet []perceptron.DecodedInstance, Iterations int, filename string, paramModel perceptron.Model, decoder perceptron.EarlyUpdateInstanceDecoder, goldDecoder perceptron.InstanceDecoder, converge perceptron.StopCondition) *perceptron.LinearPerceptron

func TrainingSequences

func TrainingSequences(trainingSet []interface{}, instFunc InstanceFunc, goldFunc GoldFunc) []perceptron.DecodedInstance

func ValidMAGold

func ValidMAGold(cmd *commander.Command, args []string) error

func ValidMAGoldConfigOut

func ValidMAGoldConfigOut(t transition.TransitionSystem)

func ValidateCorpus

func ValidateCorpus(goldSequences []perceptron.DecodedInstance) map[string]int

func ValidateInstance

func ValidateInstance(decoded perceptron.DecodedInstance) string

func ValidateMAGoldCmd

func ValidateMAGoldCmd() *commander.Command

func VerifyExists

func VerifyExists(filename string) bool

func VerifyFlags

func VerifyFlags(cmd *commander.Command, required []string)

func WriteModel

func WriteModel(file string, data *Serialization)

func Xliter8

func Xliter8(cmd *commander.Command, args []string) error

func Xliter8Cmd

func Xliter8Cmd() *commander.Command

func Xliter8ConfigOut

func Xliter8ConfigOut()

Types

type GoldFunc

type GoldFunc func(interface{}) util.Equaler

type InstanceFunc

type InstanceFunc func(interface{}) util.Equaler

type Parser

type Parser interface {
	Parse(search.Problem) (transition.Configuration, interface{})
}

type Serialization

type Serialization struct {
	WeightModel                          *model.AvgMatrixSparseSerialized
	EWord, EPOS, EWPOS, EMHost, EMSuffix *util.EnumSet
	EMorphProp                           *util.EnumSet
	ETrans                               *util.EnumSet
	ETokens                              *util.EnumSet
}

func ReadModel

func ReadModel(file string) *Serialization

Jump to

Keyboard shortcuts

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