Exemplo n.º 1
0
        public void SoundexTest()
        {
            string s1 = Soundex.For("Jansen");
            string s2 = Soundex.For("Jenssen");

            Assert.AreEqual(s1, s2);
        }
Exemplo n.º 2
0
        public static int SoundExComparision(Person person)
        {
            string[] Words = new[] { "Spotify", "amal", "Sputfy", "Sputfi" };

            int val = 0;

            //MatchRatingApproach _generator = new MatchRatingApproach();
            //Console.WriteLine(_generator.IsSimilar(Words));

            if (Soundex.For(person.FirstName) == Soundex.For(fName))
            {
                val = val + 1;
            }


            if (Soundex.For(person.LastName) == Soundex.For(LName))
            {
                val = val + 1;
            }
            else
            {
                val = val + 0;
            }
            return(val);
        }
Exemplo n.º 3
0
        public void ForTests()
        {
            Soundex soundex = new Soundex();
            string  word, expected, actual;

            word     = "";
            expected = "0000";
            actual   = soundex.For(word);
            Assert.AreEqual(expected, actual);

            word     = null;
            expected = "0000";
            actual   = soundex.For(word);
            Assert.AreEqual(expected, actual);

            word     = "Robert";
            expected = "R163";
            actual   = soundex.For(word);
            Assert.AreEqual(expected, actual);

            word   = "Rupert".ToLower();
            actual = soundex.For(word);
            Assert.AreEqual(expected, actual);

            word     = "Rubin";
            expected = "R150";
            actual   = soundex.For(word);
            Assert.AreEqual(expected, actual);

            word     = "Ashcraft";
            expected = "A261";
            actual   = soundex.For(word);
            Assert.AreEqual(expected, actual);

            word   = "Ashcroft";
            actual = soundex.For(word);
            Assert.AreEqual(expected, actual);

            word     = "Tymczak";
            expected = "T522";
            actual   = soundex.For(word);
            Assert.AreEqual(expected, actual);

            word     = "Pfister";
            expected = "P236";
            actual   = soundex.For(word);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
 public override bool IncrementToken()
 {
     if (input.IncrementToken())
     {
         string currentTerm = _termAttr.Term;
         // Any phonetic hash calculation will work here.
         var hash = Soundex.For(currentTerm);
         _termAttr.SetTermBuffer(hash);
         return(true);
     }
     return(false);
 }
Exemplo n.º 5
0
 public override string GroomElement(string value)
 {
     return(Soundex.For(value));
 }
Exemplo n.º 6
0
 public override string GroomElement(string value) => Soundex.For(value);
Exemplo n.º 7
0
        public override IMongoQuery BuildQuery(ITerm term)
        {
            string value = Soundex.For(term.Value);

            return(Query.EQ(term.Field, value));
        }