output

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	// Date represents time when output was generated.
	Date time.Time `json:"date"`
	// FinderVersion the version of gnfinder
	FinderVersion string
	// Language inside name-finding algorithm
	Language string `json:"language"`
	// LanguageDetected automatically for the text
	LanguageDetected string `json:"language_detected"`
	// LanguageForced by language option
	DetectLanguage bool `json:"detect_language"`
	// TotalTokens is a number of 'normalized' words in the text
	TotalTokens int `json:"total_words"`
	// TotalNameCandidates is a number of words that might be a start of
	// a scientific name
	TotalNameCandidates int `json:"total_candidates"`
	// TotalNames is a number of scientific names found
	TotalNames int `json:"total_names"`
	// CurrentName (optional) is the index of the names array that designates a
	// "position of a cursor". It is used by programs like gntagger that allow
	// to work on the list of found names interactively.
	CurrentName int `json:"current_index,omitempty"`
}

Meta contains meta-information of name-finding result.

type Name

type Name struct {
	Type         string                 `json:"type"`
	Verbatim     string                 `json:"verbatim"`
	Name         string                 `json:"name"`
	Odds         float64                `json:"odds,omitempty"`
	OddsDetails  token.OddsDetails      `json:"odds_details,omitempty"`
	OffsetStart  int                    `json:"start"`
	OffsetEnd    int                    `json:"end"`
	Annotation   string                 `json:"annotation"`
	Verification *verifier.Verification `json:"verification,omitempty"`
}

Name represents one found name.

type OddsDatum

type OddsDatum struct {
	Name bool
	Odds float64
}

OddsDatum is a simplified version of a name, that stores boolean decision (Name/NotName), and corresponding odds of the name.

type Output

type Output struct {
	Meta  `json:"metadata"`
	Names []Name `json:"names"`
}

Output type is the result of name-finding.

func TokensToOutput

func TokensToOutput(ts []token.Token, text []rune, l lang.Language,
	code string, version string) *Output

TokensToOutput takes tagged tokens and assembles output out of them.

func (*Output) FromJSON

func (o *Output) FromJSON(data []byte)

FromJSON converts JSON representation of Outout to Output object.

func (*Output) MergeVerification

func (o *Output) MergeVerification(v verifier.Output)

MergeVerification takes a map with verified names and incorporates into output.

func (*Output) ToJSON

func (o *Output) ToJSON() []byte

ToJSON converts Output to JSON representation.

func (*Output) UniqueNameStrings

func (o *Output) UniqueNameStrings() []string

UniqueNameStrings takes a list of names, and returns a list of unique name-strings

Jump to

Keyboard shortcuts

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