Coder Social home page Coder Social logo

phonix's Introduction

Welcome to Phonix

Build Status

A Phonetic open source libray for .NET, no dependencies, it is pure C# code ;)

Now with support for .NET Core (thanks @ysilvestrov) and VS 2017 (thanks to @spboyer)

Latest Version

The quickest way to get the latest release of Phonix is to add it to your project using NuGet (http://nuget.org/List/Packages/Phonix).

Implemented algorithms

Today Phonix implements the following algorithms:

How to use

Below there are examples on how to use the MatchRating, DoubleMetaphone and Soundex algorithms:


    using Phonix;
    
    public class MatchRatingApproachTests
    {
        private static readonly string[] Words = new[] { "Spotify", "Spotfy", "Sputfy","Sputfi" };

        readonly MatchRatingApproach _generator = new MatchRatingApproach();
       
        public void Should_Be_Similar()
        {
            Console.Writeline(_generator.IsSimilar(Words));
        }
    }
    
    public class SoundexTests
    {
        private static readonly string[] Words = new[] { "Spotify", "Spotfy", "Sputfi", "Spotifi" };
        private static readonly string[] Words2 = new[] { "United Air Lines", "United Aire Lines", "United Air Line" };

        readonly Soundex _generator = new Soundex();

        public void Should_Be_Similar()
        {
            Console.Writeline(_generator.IsSimilar(Words));
            Console.Writeline(_generator.IsSimilar(Words2));
        }
    }
    
    public class DoubleMetaphoneTests
    {
        private static readonly string[] Words = new[] {"Spotify", "Spotfy", "Sputfi", "Spotifi"};
        private static readonly string[] Words2 = new[] { "United Air Lines", "United Aire Lines", "Unitid Air Line"};

        readonly DoubleMetaphone _generator =  new DoubleMetaphone();
              
        public void Should_Return_Same_Keys()
        {
            string[][] keys =  new string[Words.Length][];
            for (int n = 0; n < Words.Length; n++)
            {
                keys[n] =  _generator.BuildKeys(Words[n]);
            }

            for (int n = 0; n < Words.Length; n++)
            {
                for (int m = 0; m < keys[n].Length; m++)
                {
                    if (n > 0)
                    {
                        Console.Writeline(keys[n][m], keys[n - 1][m]);
                    }
                }
            }

            string[][] keys2 = new string[Words2.Length][];
            for (int n = 0; n < Words2.Length; n++)
            {
                keys2[n] = _generator.BuildKeys(Words2[n]);
            }

            for (int n = 0; n < Words2.Length; n++)
            {
                for (int m = 0; m < keys2[n].Length; m++)
                {
                    Console.WriteLine(keys2[n][m]);
                    if (n > 0)
                    {
                        Console.Writeline(keys2[n][m], keys2[n - 1][m]);
                    }
                }
            }
        }
    }

phonix's People

Contributors

abdullahalmaz avatar eldersantos avatar spboyer avatar ysilvestrov avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phonix's Issues

Publish .NET Core version to NuGet

Do you intend to publish to NuGet? If not let me know and I will re-branch/brand and publish as new.

This is a great library, as a student of name searching algorithms it is something I had started many times and not finished. Very complete work. Kudos.

Not able to execute the program

I've downloaded the zip file and opened as a project in Visual Studio 2017, When I clicked F5 to run the program its showing error:
program does not contain static 'main' method suitable for an entry point

Can you please solve this problem and help me to learn the working of the phonetics algorithm that you have built.

Thanks in advance :)

IsSimilar Method Only Uses Primary Value

No sure if this is an issue or not, but looking at the code, is the IsSimilar method only using the 0 location on the array, aka the primary Double Metaphone value?

Should it not be something like....

  • (Primary Key = Primary Key) = Strongest Match
  • (Secondary Key = Primary Key) = Normal Match
  • (Primary Key = Secondary Key) = Normal Match
  • (Alternate Key = Alternate Key) = Minimal Match

Happy to implement, and issue a PR, but.. thoughts?

index out of bound exception with some names

I'm getting this error with a few names, mostly those which end with an "i".
For example the name "marggi".

var _generator = new MatchRatingApproach();
Console.WriteLine(_generator.MatchRatingCompute("hofer", "marggi"));

I'm using VS2017 with .NET Framework 4.6.1.

Could that be fixed?

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.