Skip to content

This package is is a Go implementation of the Metaphone algorithm for phonetic string matching and comparison in Brazilian Portuguese language. It can be used to encode words or phrases into their phonetic representations, which can then be used for tasks such as fuzzy string matching, spell correction, and text-to-speech applications.

License

Notifications You must be signed in to change notification settings

DanielFillol/metaphone-br

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metaphone-br

It is a Go implementation of the Metaphone phonetic algorithm for brazilian portuguese. It provides a way to generate a phonetic representation of a given string, which can be used for tasks such as string matching and deduplication.

Install

You can install Metaphone using Go's built-in package manager, go get:

go get github.com/Darklabel91/metaphone-br

Usage

Here's a simple example of how to use Metaphone:

package main

import (
	"fmt"
	Metaphone "github.com/Darklabel91/metaphone-br"
)

func main() {
	word1 := "Rafael"
	word2 := "Raphael"

	//word to metaphone code
	metaphoneWord1 := Metaphone.Pack(word1)
	metaphoneWord2 := Metaphone.Pack(word2)
	fmt.Println(metaphoneWord1, metaphoneWord2)

	//metaphone comparison
	isSimilar := Metaphone.IsMetaphoneSimilar(metaphoneWord1, metaphoneWord2)
	fmt.Println(isSimilar)

	//word comparison
	isWordSimilar := Metaphone.SimilarityBetweenWords(word1, word2)
	fmt.Println(isWordSimilar)

	//parsing word
	parsedWord1 := Metaphone.Parse(word1)
	parsedWord2 := Metaphone.Parse(word2)
  	fmt.Println(parsedWord1, parsedWord2)
}

This will be the output:

2F 2F
true
0.71428573
RAFAEL (2F) RAPHAEL (2F)

Testing

Metaphone-br comes with a set of tests that you can run using Go's built-in testing tool:

go test

Dependency

Levenshtein

About

This package is is a Go implementation of the Metaphone algorithm for phonetic string matching and comparison in Brazilian Portuguese language. It can be used to encode words or phrases into their phonetic representations, which can then be used for tasks such as fuzzy string matching, spell correction, and text-to-speech applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages