matcher

package
v0.13.7 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 1 Imported by: 4

Documentation

Overview

Package matcher provides main data-structures that describe input and

output of gnmatcher functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input added in v0.13.4

type Input struct {
	// Names is a slice of name-strings.
	Names []string

	// WithSpeciesGroup -- when true, species are searched within species group.
	// It means that autonyms in botany and coordination names in zoology.
	WithSpeciesGroup bool
}

Input for the matcher includes a slice of name-strings several options sent to the matcher.

type MatchItem

type MatchItem struct {
	// ID is a UUIDv5 generated out of MatchStr.
	ID string `json:"id"`

	// InputStr is the string used for matching. Usually it is the canonical
	// form of the input name. However, if matching was partial, it is
	// the string that was created by partial matching algorithm.
	InputStr string `json:"inputString"`

	// MatchStr is the string that matched a particular input. More often than
	// not it is a canonical form of a name. However for viruses it
	// can be matched string from the database.
	MatchStr string `json:"matchString"`

	// MatchType describe what kind of match happened.
	MatchType vlib.MatchTypeValue `json:"matchType"`

	// EditDistance is a Levenshtein edit distance between
	// InputStr and MatchStr.
	EditDistance int `json:"editDistance"`

	// EditDistanceStem is a Levenshtein edit distance between stemmed
	// InputStr and stemmed MatchStr.
	EditDistanceStem int `json:"editDistanceStem"`
}

MatchItem describes one matched string and its properties.

type Output added in v0.13.4

type Output struct {
	// ID is UUIDv5 generated from verbatim input name-string.
	ID string `json:"id"`

	// Name is verbatim input name-string.
	Name string `json:"input"`

	// MatchType describe what kind of match happened.
	MatchType vlib.MatchTypeValue `json:"matchType"`

	// MatchItems provide all matched data. It will be empty if no matches
	// occured.
	MatchItems []MatchItem `json:"matchItems,omitempty"`
}

Output is output of MatchAry method.

Jump to

Keyboard shortcuts

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