textmatch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package textmatch compares titles and names across sources and the metadata catalogue: every site writes a title its own way (case, width, accents, punctuation, word order of names). It normalizes the same way the metadata service does, so both agree on what "the same title" is.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Best

func Best(as, bs []string) (score float64, a, b string)

Best returns the best similarity between any of as and any of bs, and the pair that scored it.

func Normalize

func Normalize(s string) string

Normalize folds compatibility forms (full-width Latin, half-width kana), removes diacritics, lowercases, drops apostrophes, turns other punctuation into spaces and collapses spaces.

func PeopleOverlap

func PeopleOverlap(as, bs []string) bool

PeopleOverlap reports whether any name in as is the same person as any in bs.

func SameName

func SameName(a, b string) bool

SameName reports whether two person names are the same person as far as text tells: the same words in any order ("Akira Toriyama" and "Toriyama Akira"), or one written without spaces.

func Similarity

func Similarity(a, b string) float64

Similarity scores how alike two titles are, from 0 to 1: 1 when they normalize the same; otherwise the best of an edit-distance ratio and a word-set ratio (which forgives reordered or extra words such as a subtitle on one side).

Types

This section is empty.

Jump to

Keyboard shortcuts

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