Code Monkey home page Code Monkey logo

metaphone3's Introduction

metaphone3 - a sound-a-like index for names

Metaphone3 is a more accurate version of the original Soundex algorithm. It's designed so that similar-sounding words in American English share the same keys. For example Smith, Smyth, Smithe, Smythe all encode to SM0 primary and XMT alt. Whereas Schmidt encodes to XMT primary with no secondary.

Searching for matches where either primary or secondary matches will give the best results.

You can read more about Metaphone on Wikipedia.

Usage

Basic usage of the encoder looks like this:

	e := &metaphone3.Encoder{}
	prim, second := e.Encode("Smith")

An Encoder is designed to be re-used to reduce memory pressure at scale and has three settable options. An Encoder is not thread-safe so it is not safe to use one Encoder across goroutines. If you're comparing values you must use the exact same options.

Option Type Default Purpose
EncodeExact bool false Setting EncodeExact to true will tighten the output so that certain sounds will be differentiated. E.g. more separation between hard "G" sounds and hard "K" sounds.
EncodeVowels bool false Setting EncodeVowels to true will include non-first-letter vowel sounds in the output. By default only consonent sounds are included.
MaxLength int metaphone3.DefaultMaxLength This limits the output of long words and is useful to reduce the cycles and memory spent on processing long words.
metaphone3.DefaultMaxLength int 8 If MaxLength is 0 (or negative) then it defaults as metaphone3.DefaultMaxLength, which starts as 8 (like the java implementation).

Additional usage details available in the godocs.

Basis for algorithm

The reference implementation of metaphone3 in Java can be found here.

Differences from v2.1.3 Java Implementation

  • Fix ROBILL
  • Fix lengths for very long words where certain situations would cause the primary or secondary to get too long and the other would get truncated. (e.g. Villafranca when EncodeVowel is true)
  • Fix JAKOB
  • Fix ending CIAS and CIOS (e.g. MECIAS)
  • Fix words starting with HARGER
  • Fix SUPERNODE (prevent D from being silent)

metaphone3's People

Contributors

dlclark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

metaphone3's Issues

Application is Not Run

I have Imported this Application in Eclipse IDE Suppose I am running this but i am getting only Error:0 Exception. please help

Correct way of using this module

Hello,

I am new to Go. I have followed a number of instructions to get this module working. To no avail.

I may be wrong, but the issue may be related to the fact that "go get" has been deprecated as an installation method:

https://go.dev/doc/go-get-install-deprecation

Is there any chance you could provide instructions on how to install and use this module?

Best regards,

Ed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.