contextualstringembeddings

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package contextualstringembeddings provides an implementation of the "Contextual String Embeddings" of words (Akbik et al., 2018). https://www.aclweb.org/anthology/C18-1139/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MergeType

type MergeType int

MergeType is the enumeration-like type used for the set of merging methods which a Contextual String Embeddings model Processor can perform.

const (
	// Concat merging method: the outputs are concatenated together (the default)
	Concat MergeType = iota
	// Sum merging method: the outputs are added together
	Sum
	// Prod merging method: the outputs multiplied element-wise together
	Prod
	// Avg merging method: the average of the outputs is taken
	Avg
)

type Model

type Model struct {
	nn.BaseModel
	LeftToRight *charlm.Model
	RightToLeft *charlm.Model
	MergeMode   MergeType
	StartMarker rune
	EndMarker   rune
}

Model contains the serializable parameters for a Contextual String Embeddings model.

func New

func New(leftToRight, rightToLeft *charlm.Model, merge MergeType, startMarker, endMarker rune) *Model

New returns a new Contextual String Embeddings Model.

func (*Model) Encode added in v0.2.0

func (m *Model) Encode(words []string) []ag.Node

Encode performs the forward step for each input and returns the result.

Jump to

Keyboard shortcuts

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