protected int SearchWordFromExSet(string word)
        {
            int res = 0;

            foreach (KeyValuePair <string, Dictionary <string, string> > kvp in ExceptionDict)
            {
                int cnt = StringDistance.GetDamerauLevenshteinDistance(
                    kvp.Key, word);

                /* Алгоритм Ливенштейна (модицифированный)
                 * Если cnt поставить на ноль, то он будет искать слова со 100%-ым
                 * совпадением. А если на 1, то на одну букву будет делать погрешность,
                 * допустим слово dadanlar он пропустит, так как отличие всего одна
                 * буква n (а должно быть dadamlar)
                 * в ближайшей перспективе сделаем систему РЕКОМЕНДАЦИЙ,
                 * типа, "возможно, вы имели ввиду это слово"?
                 */

                if (cnt == 0)
                {
                    this.TmpDict = kvp.Value;
                    res          = 1;
                    break;
                }
            }

            return(res);
        }
        public Dictionary <string, string> GetResult(string word)
        {
            int        last_index             = word.Length;
            List <int> numberOfElementsInDict = new List <int>();

            ///Вычисляем по KhorezmDict слово
            string[] listOfKhorezmKeys = KhorezmDict.Keys.ToArray();
            Array.Sort(listOfKhorezmKeys);
            int key2 = Array.BinarySearch(listOfKhorezmKeys, word);

            for (int i = 0; i < listOfKhorezmKeys.Length; i++)
            {
                int t = 0;
                t = StringDistance.GetDamerauLevenshteinDistance(listOfKhorezmKeys[i], word);
                if (t <= 2)
                {
                    this.KhorezmDictForReturn = KhorezmDict[listOfKhorezmKeys[i]];
                    this.KhorezmDictForReturn.Add("Perhaps, you meant this Khorezm word: ", listOfKhorezmKeys[i]);
                    return(KhorezmDictForReturn);
                }
            }

            // Dictionary<string, string>[] InnerDict =
            //  new Dictionary<string, string>[last_index];
            Dictionary <string, string> InnerDict =
                new Dictionary <string, string>();
            int k = 0;

            /*
             * for(int i = last_index-1; i >= 0; i--)
             * {
             *  this.MainWord = word.Remove(i, k);
             */
            InnerDict = new Dictionary <string, string>(GetResultPrivate(word));

            //}

            //Возвращаем результат если словарь пуст
            //InnerDict["Message"] = StaticString.NotFoundedEng;

            return(InnerDict);
        }
        protected bool SearchWordFromExSet(string word)
        {
            //GetEndingsParent.ResultNumber = 0;

            //We define string array and set a value to it (keys of ExceptionDict)
            string[] listOfKeys = ExceptionDict.Keys.ToArray();

            //we sort listOfKeys, thanks to this,
            //we can be sure in the way to use binarySearch
            Array.Sort(listOfKeys);


            //I set negative value due to this variable can hold 0,
            //if binarySearch find key in position(0). So, negative value is the best option
            int key1 = Array.BinarySearch(listOfKeys, word);

            //If key is more than 0 (including itself), then it means that
            //there is a word in Exception Dict
            if (key1 >= 0)
            {
                this.TmpDict = ExceptionDict[word];
                return(true);
            }
            else
            {
                ///We launch Levenstein Algrorithm
                for (int i = 0; i < listOfKeys.Length; i++)
                {
                    int t = StringDistance.GetDamerauLevenshteinDistance(listOfKeys[i], word);
                    if (t <= 1)
                    {
                        this.TmpDict = ExceptionDict[listOfKeys[i]];
                        this.TmpDict.Add("Perhaps, you meant: ", listOfKeys[i]);

                        return(true);
                    }
                }
            }


            return(false);
        }