output

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "v0.4.2+"
	Build   string
)

Functions

func CSVHeader added in v0.13.0

func CSVHeader() string

func NewSimpleOutput

func NewSimpleOutput(sn *grammar.ScientificNameNode) *simple

func ToCSV added in v0.13.0

func ToCSV(record []string) string

Types

type Output

type Output struct {
	// Parsed is true if parsing of a name-string succeeded.
	Parsed bool `json:"parsed"`
	// Quality of parsing. 1 - no problems, 2 - some small problems,
	// 3 - significant problems with a name-string.
	Quality int `json:"quality"`
	// Warnings generated by parsing. A warning contains a message and
	// an associated with it quality of parsing. The largest quality number
	// becomes an overal quality of parsing.
	Warnings []Warning `json:"qualityWarnings,omitempty"`
	// Verbatim input of a name-string.
	Verbatim string `json:"verbatim"`
	// Normalized is a cleaned-up version of a name.
	Normalized string `json:"normalized,omitempty"`
	// Cardinality is a number of main elements in a name. 0 - N/A, 1 - Uninomial,
	// 2 - Binomial, 3 - Trinomial etc.
	Cardinality int `json:"cardinality"`
	// CanonicalName -- three versions of a canonical form of a name.
	CanonicalName *canonical `json:"canonicalName,omitempty"`
	// Authorship of a name-string, if available.
	Authorship string `json:"authorship,omitempty"`
	// Parsing details.
	Details []interface{} `json:"details,omitempty"`
	// Positions and a semantic meanings of words in the name-strings.
	Positions []pos `json:"positions,omitempty"`
	// Unofficial name-string label (for example names from BOLD project,
	// names with annotations etc.).
	Surrogate bool `json:"surrogate"`
	// Name seem to be a virus, vector, prion etc.
	Virus bool `json:"virus"`
	// Hybrid is true if a name-string is classied as a hybrid.
	Hybrid bool `json:"hybrid"`
	// Bacteria is true if a name-string is classified as a bacteria.
	Bacteria bool `json:"bacteria"`
	// Tail is an unparseable tail of a name-string.
	Tail string `json:"unparsedTail,omitempty"`
	// NameStringID is a UUID v5 of a verbatim version of a name-string. This
	// UUID uses globalnames.org DNS as a seed.
	NameStringID string `json:"nameStringId"`
	// ParserVersion is a version of the gnparser used to generate the output.
	ParserVersion string `json:"parserVersion"`
}

Output is a result of parsing that can be returned in JSON or CSV formats.

func FromJSON

func FromJSON(data []byte) (Output, error)

FromJSON converts JSON representation of Outout to Output object.

func NewOutput

func NewOutput(sn *grm.ScientificNameNode) *Output

func (*Output) ToJSON

func (o *Output) ToJSON(pretty bool) ([]byte, error)

ToJSON converts Output to JSON representation.

type Warning

type Warning struct {
	Quality int
	Message string
}

func (*Warning) MarshalJSON

func (w *Warning) MarshalJSON() ([]byte, error)

func (*Warning) UnmarshalJSON

func (w *Warning) UnmarshalJSON(bs []byte) error

Jump to

Keyboard shortcuts

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