예제 #1
0
        public static bool StringMatchesPhonetics(string s, IEnumerable<string> phoenitics)
        {
            DoubleMetaphone m = new DoubleMetaphone();
            IEnumerable<string> lhsPhoenetics = m.Get(s);
            IEnumerable<string> rhsPhoenetics = phoenitics;

            foreach (string lhsPhoenetic in lhsPhoenetics)
            {
                foreach (string rhsPhoenetic in rhsPhoenetics)
                {
                    if (rhsPhoenetic.Contains(lhsPhoenetic) &&
                        rhsPhoenetic.Length - lhsPhoenetic.Length <= 2)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
예제 #2
0
 public static bool StringMatchesString(string lhs, string rhs)
 {
     DoubleMetaphone m = new DoubleMetaphone();
     return StringMatchesPhonetics(lhs, m.Get(rhs));
 }
예제 #3
0
 public static string[] GetPhonetics(string s)
 {
     DoubleMetaphone m = new DoubleMetaphone();
     return m.Get(s);
 }