confusables

package module
v0.0.0-...-4ab98ab Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2020 License: BSD-3-Clause Imports: 2 Imported by: 6

README

Unicode confusables

This Go library implements the Skeleton algorithm from Unicode TR39

See http://www.unicode.org/reports/tr39/

Examples
import "github.com/mtibben/confusables"

confusables.Skeleton("𝔭𝒶ỿ𝕡𝕒ℓ")  # "paypal"
confusables.Confusable("𝔭𝒶ỿ𝕡𝕒ℓ", "paypal")  # true

Note on the use of Skeleton, from TR39:

A skeleton is intended only for internal use for testing confusability of strings; the resulting text is not suitable for display to users, because it will appear to be a hodgepodge of different scripts. In particular, the result of mapping an identifier will not necessary be an identifier. Thus the confusability mappings can be used to test whether two identifiers are confusable (if their skeletons are the same), but should definitely not be used as a "normalization" of identifiers.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confusable

func Confusable(x, y string) bool

func Skeleton

func Skeleton(s string) string

Skeleton converts a string to its "skeleton" form as described in http://www.unicode.org/reports/tr39/#Confusable_Detection

func SkeletonTweaked

func SkeletonTweaked(s string) string

SkeletonTweaked is like Skeleton, but it implements some custom overrides to the confusables table (currently it removes the m -> rn mapping):

Types

This section is empty.

Jump to

Keyboard shortcuts

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