lattice

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

Documentation

Index

Constants

View Source
const (
	FIELD_SEPARATOR      = '\t'
	NUM_FIELDS           = 8
	FEATURES_SEPARATOR   = "|"
	FEATURE_SEPARATOR    = "="
	FEATURE_CONCAT_DELIM = ","
)
View Source
const (
	PRONOMINAL_CLITIC_POS = "S_PRN"
)

Variables

View Source
var (
	ECMx_INSTANCES          = map[string]bool{"ECMW": true, "ECMI": true, "ECMH": true, "ECMM": true}
	IGNORE_LEMMA            = false
	IGNORE_DUP              = true
	WORD_TYPE               = "form"
	IGNORE_NNP_FEATS        = false
	OVERRIDE_XPOS_WITH_UPOS bool
)

Functions

func Lattice2Sentence

func Lattice2Sentence(lattice Lattice, eWord, ePOS, eWPOS, eMorphFeat, eMHost, eMSuffix *util.EnumSet) nlp.LatticeSentence

func Lattice2SentenceCorpus

func Lattice2SentenceCorpus(corpus Lattices, eWord, ePOS, eWPOS, eMorphFeat, eMHost, eMSuffix *util.EnumSet) []interface{}

func ParseInt

func ParseInt(value string) (int, error)

func ParseString

func ParseString(value string) string

func UDWrite added in v1.2.0

func UDWrite(writer io.Writer, lattices []Lattice) error

func UDWriteJSON added in v1.2.0

func UDWriteJSON(writer io.Writer, lattices []Lattice) error

func Write

func Write(writer io.Writer, lattices []Lattice) error

func WriteFile

func WriteFile(filename string, sents []Lattice) error

func WriteUDFile added in v1.2.0

func WriteUDFile(filename string, sents []Lattice) error

func WriteUDJSONFile added in v1.2.0

func WriteUDJSONFile(filename string, sents []Lattice) error

Types

type Edge

type Edge struct {
	Start    int // can be negative, if so skip over
	End      int
	Word     string
	Lemma    string
	CPosTag  string
	PosTag   string
	Feats    Features
	FeatStr  string
	Token    int
	Id       int
	TokenStr string
}

func ParseEdge

func ParseEdge(record []string) (*Edge, error)

func ParseUDEdge added in v1.2.0

func ParseUDEdge(record []string) (*Edge, error)

func (*Edge) Copy

func (e *Edge) Copy() *Edge

func (Edge) Equal

func (e Edge) Equal(other Edge) bool

func (Edge) String

func (e Edge) String() string

func (Edge) UDString added in v1.2.0

func (e Edge) UDString() string

type EdgeSlice

type EdgeSlice []Edge

func (EdgeSlice) Len

func (e EdgeSlice) Len() int

func (EdgeSlice) Less

func (e EdgeSlice) Less(i, j int) bool

func (EdgeSlice) Swap

func (e EdgeSlice) Swap(i, j int)

type Features

type Features map[string]string

func ParseFeatures

func ParseFeatures(featuresStr string) (Features, error)

func (Features) Copy

func (f Features) Copy() Features

func (Features) MorphHost

func (f Features) MorphHost() string

func (Features) MorphSuffix

func (f Features) MorphSuffix() string

func (Features) String

func (f Features) String() string

func (Features) Union

func (f Features) Union(other Features)

type JSONEdge added in v1.2.0

type JSONEdge struct {
	Next    string `json:"next"`
	Form    string `json:"form"`
	Lemma   string `json:"lemma,omitempty"`
	UPOSTag string `json:"upostag"`
	XPOSTag string `json:"xpostag,omitempty"`
	Feats   string `json:"feats,omitempty"`
	Misc    string `json:"misc,omitempty"`
	TokenID int    `json:"tokenid,omitempty"`
}

type JSONLattice added in v1.2.0

type JSONLattice map[string][]JSONEdge

type Lattice

type Lattice map[int][]Edge

func Read

func Read(r io.Reader, limit int) ([]Lattice, error)

func ReadFile

func ReadFile(filename string, limit int) ([]Lattice, error)

func ReadUDFile added in v1.2.0

func ReadUDFile(filename string, limit int) ([]Lattice, error)

func Sentence2Lattice

func Sentence2Lattice(lattice nlp.LatticeSentence, xliter8or xliter8.Interface) Lattice

func Sentence2LatticeCorpus

func Sentence2LatticeCorpus(corpus []nlp.LatticeSentence, xliter8or xliter8.Interface) []Lattice

func UDRead added in v1.2.0

func UDRead(r io.Reader, limit int) ([]Lattice, error)

func (Lattice) MaxKey

func (l Lattice) MaxKey() (retval int)

type Lattices

type Lattices []Lattice

Jump to

Keyboard shortcuts

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