config

package
Version: v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: MIT Imports: 3 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 {
	// Format output format for finding results
	Format gnfmt.Format

	// Language for name-finding in the text.
	Language lang.Language

	// LanguageDetected is the code of a language that was detected in text.
	// It is an empty string, if detection of language is not set.
	LanguageDetected string

	// WithLanguageDetection flag is true if we want to detect language automatically.
	WithLanguageDetection bool

	// WithBayes is true when we run WithBayes algorithm, and false when we dont.
	WithBayes bool

	// WithOddsAdjustment is true if we use the density of found names to
	// recalculate odds.
	WithOddsAdjustment bool

	// WithBayesOddsDetails show odds calculation details in the CLI output.
	WithBayesOddsDetails bool

	// BayesOddsThreshold sets the limit of posterior odds. Everything bigger
	// that this limit will go to the names output.
	BayesOddsThreshold float64

	// WithVerification is true if names should be verified
	WithVerification bool

	// PreferredSources is a list of data-source IDs for verification
	PreferredSources []int

	// TokensAround gives number of tokens kepts before and after each
	// name-candidate.
	TokensAround int
}

Config is responsible for name-finding operations.

func New

func New(opts ...Option) Config

New creates GNfinder object with default data, or with data coming from opts.

type Option

type Option func(*Config)

Option type for changing GNfinder settings.

func OptBayesThreshold

func OptBayesThreshold(f float64) Option

OptBayesThreshold is an option for name finding, that sets new threshold for results from the Bayes name-finding. All the name candidates that have a higher threshold will appear in the resulting names output.

func OptFormat

func OptFormat(f gnfmt.Format) Option

OptFormat sets output format

func OptLanguage

func OptLanguage(l lang.Language) Option

OptLanguage sets a language of a text.

func OptPreferredSources

func OptPreferredSources(is []int) Option

OptPOptPreferredSources sets data sources that will always be checked during verification process.

func OptTokensAround

func OptTokensAround(i int) Option

OptTokensAround sets number of tokens rememberred on the left and right side of a name-candidate.

func OptWithBayes

func OptWithBayes(b bool) Option

OptWithBayes is an option that forces running bayes name-finding even when the language is not supported by training sets.

func OptWithBayesOddsDetails

func OptWithBayesOddsDetails(b bool) Option

OptWithBayesOddsDetails option to show details of odds calculations.

func OptWithLanguageDetection

func OptWithLanguageDetection(b bool) Option

OptWithLanguageDetection when true sets automatic detection of text's language.

func OptWithOddsAdjustment

func OptWithOddsAdjustment(b bool) Option

OptWithOddsAdjustment is an option that triggers recalculation of prior odds using number of found names divided by number of all name candidates.

func OptWithVerification

func OptWithVerification(b bool) Option

OptWithVerification indicates either to run or not to run the verification process after name-finding.

Source Files

Jump to

Keyboard shortcuts

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