bhlnames

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Build = "n/a"
View Source
var Version = "v0.2.2"

Functions

func GetVersion added in v0.2.2

func GetVersion() gnvers.Version

GetVersion returns BHLnames version and build information.

Types

type BHLnames

type BHLnames interface {
	// Initialize downloads of essential BHL data (corpus metadata + names) and
	// prepares the internal storage for efficient querying.
	Initialize(builder.Builder) error

	// InitCoLNomenEvents fetches Catalogue of Life (CoL) data. It finds
	// nomenclatural events in BHL, cross-referencing them with names and
	// references from CoL.
	InitCoLNomenEvents(col.Nomen) error

	// NameRefs accepts a scientific name and optional reference. It returns a
	// collection of matching references found within the BHL corpus.
	NameRefs(input.Input) (*bhl.RefsByName, error)

	// NameRefsStream processes a stream of inputs (scientific names + optional
	// references). It returns a stream of corresponding reference collections
	// found in BHL. Designed for asynchronous processing and large-scale
	// requests.
	NameRefsStream(
		ctx context.Context,
		chIn <-chan input.Input,
		chOut chan<- *bhl.RefsByName,
	) error

	// RefByPageID returns  BHL metadata for a given pageID.
	RefByPageID(pageID int) (*bhl.Reference, error)

	// RefsByExtID returns BHL metadata for a given external ID and data-source
	// ID. If allRefs is true, it returns all cached references for
	// the external ID. Otherwise it returns only the best match.
	RefsByExtID(
		extID string,
		dataSourceID int,
		allRefs bool,
	) (*bhl.RefsByName, error)

	// ItemStats returns metadata for a given itemID as well as the
	// statisics about taxonomic groups mentioned in the item.
	ItemStats(itemID int) (*bhl.Item, error)

	// ItemsByTaxon returns a collection of BHL items that have provided
	// taxon as the main taxon mentioned in the item. The taxon is a main
	// taxon if its species make more than 50% of all species in the item.
	ItemsByTaxon(taxon string) ([]*bhl.Item, error)

	// Config returns the current configuration used by the BHLnames instance.
	Config() config.Config

	// ParserPool returns a channel for accessing reusable GNparser instances.
	// This allows efficient pooling and management of name-parser resources.
	ParserPool() chan gnparser.GNparser

	// Close releases all resources (database connections, etc.) used by BHLnames.
	Close()
}

BHLnames provides methods for finding references for scientific names in the Biodiversity Heritage Library (BHL).

func New

func New(cfg config.Config, opts ...Option) BHLnames

New creates a new BHLnames instance.

type Option

type Option func(*bhlnames)

Option provides an 'interface' for setting up BHLnames instance.

func OptNLP

func OptNLP(n nlp.NLP) Option

OptNLP creates NLP instance to generate Odds for references.

func OptRefFinder

func OptRefFinder(rf reffnd.RefFinder) Option

OptRefFinder sets the RefFinder for finding references in BHL.

func OptTitleMatcher

func OptTitleMatcher(tm ttlmch.TitleMatcher) Option

OptTitleMatcher sets the TitleMatcher for finding possible matches to a reference title from the input.

Directories

Path Synopsis
ent

Jump to

Keyboard shortcuts

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