config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Batch is the size of the string slices fed into input channel for
	// verification.
	Batch int

	// DataSources are IDs of DataSources that are important for
	// user. Normally only one "the best" reusult returns. If user gives
	// preferred sources, then matches from these sources are also
	// returned.
	DataSources []int

	// Format determins the output. It can be either JSON or CSV.
	Format gnfmt.Format

	// Jobs is the number of verification jobs to run in parallel.
	Jobs int

	// NamesNumThreshold the number of names after which POST gets redirected
	// to GET.
	NamesNumThreshold int

	// VerifierURL URL for gnames verification service. It only needs to
	// be changed if user sets local version of gnames.
	VerifierURL string

	// WithAllMatches flag; if true, results include all matches per source,
	// not only the best match.
	WithAllMatches bool

	// WithCapitalization flag; if true, the first rune of the name-string
	// will be capitalized when appropriate.
	WithCapitalization bool

	// WithSpeciesGroup flag; it is true, verification tries to search not only
	// for the given species name, but also for its species group. It means that
	// searching for "Aus bus" will also search for "Aus bus bus" and vice versa.
	// This function reflects existence of autononyms in botanical code, and
	// coordinated names in zoological code.
	WithSpeciesGroup bool

	// WithRelaxedFuzzyMatch flag; when true, relaxes fuzzy matching rules.
	// This increases recall and decreases precision. It also changes the
	// maximum number of names sent to fuzzy match from 10,000 to 50, because
	// it is assumed that uses has to check every name in the result.
	// It changes fuzzy match edit distance from 1 to 2 and it makes fuzzy
	// matching match slower.
	WithRelaxedFuzzyMatch bool

	// WithUninomialFuzzyMatch flag; when true, uninomial names are not
	// restricted from fuzzy matching. Normally it creates too many false
	// positives and is switched off.
	WithUninomialFuzzyMatch bool
}

Config collects and stores external configuration data.

func New

func New(opts ...Option) Config

New is a Config constructor that takes external options to update default values to external ones.

type Option

type Option func(cnf *Config)

Option is a type of all options for Config.

func OptDataSources

func OptDataSources(srs []int) Option

OptDataSources set list of preferred sources.

func OptFormat

func OptFormat(f gnfmt.Format) Option

OptFormat sets output format

func OptJobs

func OptJobs(i int) Option

OptJobs sets number of jobs to run in parallel.

func OptNamesNumThreshold

func OptNamesNumThreshold(i int) Option

OptNamesNumThreshold sets number of names after which there is no redirect from POST to GET.

func OptVerifierURL

func OptVerifierURL(s string) Option

OptVerifierURL sets URL of the verification resource.

func OptWithAllMatches

func OptWithAllMatches(b bool) Option

OptWithAllMatches sets WithAllMatches flag.

func OptWithCapitalization

func OptWithCapitalization(b bool) Option

OptWithCapitalization sets WithCapitalization field.

func OptWithRelaxedFuzzyMatch added in v1.2.0

func OptWithRelaxedFuzzyMatch(b bool) Option

func OptWithSpeciesGroup

func OptWithSpeciesGroup(b bool) Option

OptWithSpeciesGroup sets WithSpeciesGroup field.

func OptWithUninomialFuzzyMatch added in v1.1.1

func OptWithUninomialFuzzyMatch(b bool) Option

Jump to

Keyboard shortcuts

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