output

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSVHeader

func CSVHeader(withVerification bool) string

CSVHeader returns the header string for CSV output format.

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 `json:"gnfinderVersion"`

	// WithBayes use of bayes during name-finding
	WithBayes bool `json:"withBayes"`

	// WithOddsAdjustment to adjust prior odds according to the dencity of
	// scientific names in the text.
	WithOddsAdjustment bool `json:"withOddsAdjustment"`

	// WithVerification is true if results are checked by verification service.
	WithVerification bool `json:"withVerification"`

	// TokensAround shows number of tokens preserved before and after
	// a name-string candidate.
	TokensAround int `json:"tokensAround"`

	// Language inside name-finding algorithm
	Language string `json:"language"`

	// LanguageDetected automatically for the text
	LanguageDetected string `json:"languageDetected,omitempty"`

	// LanguageForced by language option
	DetectLanguage bool `json:"detectLanguage"`

	// TotalTokens is a number of 'normalized' words in the text
	TotalTokens int `json:"totalWords"`

	// TotalNameCandidates is a number of words that might be a start of
	// a scientific name
	TotalNameCandidates int `json:"totalCandidates"`

	// TotalNames is a number of scientific names found
	TotalNames int `json:"totalNames"`

	// 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:"currentIndex,omitempty"`
}

Meta contains meta-information of name-finding result.

type Name

type Name struct {
	// Cardinality depicts number of elements in a name. 0 - Cannot determine
	// cardinality, 1 - Uninomial, 2 - Binomial, 3 - Trinomial.
	Cardinality int `json:"cardinality"`
	// Verbatim shows name the way it was in the text.
	Verbatim string `json:"verbatim"`
	// Name is a normalized version of a name.
	Name string `json:"name"`
	// Odds show a probability that name detection was correct.
	Odds float64 `json:"-"`
	// OddsLog10 show a Log10 of Odds.
	OddsLog10    float64 `json:"oddsLog10,omitempty"`
	OddsAdjLog10 float64 `json:"oddsAdjLog10,omitempty"`
	// OddsDetails descibes how Odds were calculated.
	OddsDetails token.OddsDetails `json:"oddsDetails,omitempty"`
	// OffsetStart is a start of a name on a page.
	OffsetStart int `json:"start"`
	// OffsetEnd is the end of the name on a page.
	OffsetEnd int `json:"end"`
	// AnnotNomen is a nomenclatural annotation for new species or combination.
	AnnotNomen string `json:"annotationNomen,omitempty"`
	// AnnotNomenType is normalized nomenclatural annotation.
	AnnotNomenType string `json:"annotationNomenType,omitempty"`
	// Annotation is a placeholder to add more information about name.
	Annotation string `json:"annotation,omitempty"`
	// WordsBefore are words that happened before the name.
	WordsBefore []string `json:"wordsBefore,omitempty"`
	// WordsAfter are words that happened right after the name.
	WordsAfter []string `json:"wordsAfter,omitempty"`
	// Verification gives results of verification process of the name.
	Verification *vlib.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.TokenSN,
	text []rune,
	version string,
	cfg config.Config) Output

TokensToOutput takes tagged tokens and assembles output out of them.

func (*Output) Format

func (o *Output) Format(f gnfmt.Format) string

func (*Output) MergeVerification

func (o *Output) MergeVerification(v map[string]vlib.Verification)

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

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