factory

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package factory provides the basic building block structure which governs how different components of this fuzzymatch-go module can be combined together to construct a function determining the string similarity between any two given input strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CandidatesGeneratorFunction added in v0.5.0

type CandidatesGeneratorFunction = func(string) []string

CandidatesGeneratorFunction is a type alias describing the signature of a function that generates multiple candidates where each candidate is a possible true value of the input string.

For example, there may be a string that attempts to strip all titles from the name given as the string input of the function. However, we cannot be certain if some of the titles are actually parts of the real name and not the title itself.

func Chain added in v0.6.0

Chain is a higher-order function which multiplies together candidate generator functions so that the resulting candidate generator function will produce all combinations of candidates from the provided generators.

func PrependStringSanitizerForCandidatesGenerator added in v0.6.0

func PrependStringSanitizerForCandidatesGenerator(
	sanitize StringTransformerFunction,
	generateCandidates CandidatesGeneratorFunction,
) CandidatesGeneratorFunction

PrependStringSanitizerForSimilarityScore is a higher-order function which modifies the provided generateCandidates function so that the input string to the function will be sanitized first via a call to sanitize function.

type SimilarityScoreFunction added in v0.5.0

type SimilarityScoreFunction = func(string, string) float64

SimilarityScoreFunction is a type alias describing the signature of a function that consumes two input strings and computes their string similarity score whose value is within the range from 0 to 1 where 1 indicates that both strings are semantically identical and 0 indicates that both strings are totally distinct.

func MaxFromCandidatesProduct added in v0.6.0

func MaxFromCandidatesProduct(
	generateCandidates CandidatesGeneratorFunction,
	similarityScore SimilarityScoreFunction,
) SimilarityScoreFunction

MaxFromCandidates is a higher-order function which combines the generateCandidates function and similarityScore function together. Specifically, the newly created string similarity score function will generate possible candidates from each input string, then the similarity score of all possible pair of candidates from both input strings will be computed. The returned score will the maximum scores among scores between all possible pairs of candidates.

func PrependStringSanitizerForSimilarityScore added in v0.6.0

func PrependStringSanitizerForSimilarityScore(
	sanitize StringTransformerFunction,
	similarityScore SimilarityScoreFunction,
) SimilarityScoreFunction

PrependStringSanitizerForSimilarityScore is a higher-order function which modifies the provided similarityScore function so that each input string to the function will be sanitized first via a call to sanitize function.

type StringTransformerFunction added in v0.5.0

type StringTransformerFunction = func(string) string

StringTransformer is a type alias describing the signature of a function that transforms a string into other forms. This type is useful to describe string sanitization functions, etc.

func MakeStringTransformFunction added in v0.6.0

func MakeStringTransformFunction(transformer transform.Transformer) StringTransformerFunction

MakeStringTransformFunction is a higher-order function which constructs a new string transforming function from a transformer object.

Directories

Path Synopsis
Package preset provides a collection of pre-built string similarity scoring functions generated by the higher-ordered function in the factory parent
Package preset provides a collection of pre-built string similarity scoring functions generated by the higher-ordered function in the factory parent

Jump to

Keyboard shortcuts

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