Documentation
¶
Overview ¶
package config contains information needed to run gnmatcher project.
Index ¶
- func LoadEnv(c *Config)
- type Config
- type Option
- func OptCacheDir(s string) Option
- func OptDataSources(ints []int) Option
- func OptJobsNum(i int) Option
- func OptMaxEditDist(i int) Option
- func OptPgDB(s string) Option
- func OptPgHost(s string) Option
- func OptPgPass(s string) Option
- func OptPgPort(i int) Option
- func OptPgUser(s string) Option
- func OptWithRelaxedFuzzyMatch(b bool) Option
- func OptWithSpeciesGroup(b bool) Option
- func OptWithUninomialFuzzyMatch(b bool) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// CacheDir is the main directory for gnmatcher files. It contains
// bloom filters levenshtein automata trees, key-value stores etc.
CacheDir string
// DataSources can limit matching to provided dataSources. Such approach
// helps to provide more accurate matches. For example if a searched name
// `Aus bus bus` exists somewhere but not in a data-source with ID 5,
// however this data-source contains 'Aus bus'. Setting DataSources to
// []int{5} will ignore results from other sources, and will set
// partial match, finding 'Aus bus' as with a MatchType of PartialMatch.
DataSources []int
// JobsNum is the number of jobs to run in parallel
JobsNum int
// MaxEditDist is the maximal allowed edit distance for levenshtein
// automata. The number cannot exceed 2, default number is 1. The speed of
// execution slows down dramatically with the MaxEditDist > 1.
MaxEditDist int
// PgDB the database name where gnames data is located.
PgDB string
// PgHost is a hostname for the PostgreSQL server.
PgHost string
// PgPass password to access PostgreSQL server.
PgPass string
// PgPort is the port of PostgreSQL server.
PgPort int
// PgUser is the user for the database.
PgUser string
// WithSpeciesGroup is true when searching for "Aus bus" also searches for
// "Aus bus bus".
WithSpeciesGroup bool
// WithUninomialFuzzyMatch is true when it is allowed to use fuzzy match for
// uninomial names.
WithUninomialFuzzyMatch bool
// WithRelaxedFuzzyMatch is true when it is allowed to use relaxed fuzzy
// match.
WithRelaxedFuzzyMatch bool
}
Config collects and stores external configuration data.
func New ¶
New is a Config constructor that takes external options to update default values to external ones.
func (Config) FiltersDir ¶
FiltersDir returns path where to dump/restore serialized bloom filters.
type Option ¶
type Option func(cfg *Config)
Option is a type of all options for Config.
func OptCacheDir ¶
OptCacheDir sets a directory for key-value stores and temporary files.
func OptDataSources ¶
OptDataSources sets ids to use for matching.
func OptJobsNum ¶
OptJobsNum sets the number of jobs to run in parallel
func OptMaxEditDist ¶
OptMaxEditDist sets maximal possible edit distance for fuzzy matching of stemmed canonical forms.
func OptWithRelaxedFuzzyMatch ¶ added in v1.1.10
OptWithRelaxedFuzzyMatch sets an option that allows to fuzzy-match uninomial name-strings.
func OptWithSpeciesGroup ¶
OptWithSpeciesGroup sets the WithSpeciesGroup field
func OptWithUninomialFuzzyMatch ¶ added in v1.1.2
OptWithUninomialFuzzyMatch sets an option that allows to fuzzy-match uninomial name-strings.