Beispiel #1
0
        public void Verbose_With_Levenstein()
        {
            const double latitude  = 37.786971;
            const double longitude = -122.399677;

            IStringMetric metric    = new Levenstein();
            ITokenizer    tokenizer = new Tokenizer();

            var geopages = WikiApi.Geosearch(latitude, longitude);

            foreach (var geopage in geopages)
            {
                output.WriteLine($"[{geopage.Pageid}] {geopage.Title}");

                var images = WikiApi.Images(geopage.Pageid);

                var imagesWithMetrics = images
                                        .Select(image => new { Image = image, Similarity = image.CalcMetric(geopage.Title, tokenizer, metric) })
                                        .ToList();
                var title = imagesWithMetrics.Aggregate((image, next) => next.Similarity > image.Similarity ? next : image);

                output.WriteLine($"\t*[{title.Image.Ns}] {title.Image.Title} {title.Similarity}");

                foreach (var image in imagesWithMetrics)
                {
                    output.WriteLine($"\t[{image.Image.Ns}] {image.Image.Title} {image.Similarity}");
                }
            }
        }
        public async Task <Dictionary <RaidbossPokemon, double> > GetSimilarRaidbossByNameAsync(string name, int limit = int.MaxValue)
        {
            var algorithm  = new Levenstein();
            var rankedList =
                Pokemon.Select(e => new { Pokemon = e, Rank = algorithm.GetSimilarity(e.Name, name) })
                .OrderByDescending(e => e.Rank)
                .Where(e => e.Rank > 0.1f);
            var raidbosses      = RaidbossService.Raidbosses;
            var pokemonWithBoss = new Dictionary <RaidbossPokemon, double>();

            foreach (var pokemon in rankedList)
            {
                foreach (var raidboss in raidbosses)
                {
                    if (pokemon.Pokemon.Id == raidboss.Id)
                    {
                        pokemonWithBoss.Add(new RaidbossPokemon(pokemon.Pokemon, raidboss), pokemon.Rank);
                    }
                }
                if (pokemonWithBoss.Count >= limit)
                {
                    break;
                }
            }

            return(await Task.FromResult(pokemonWithBoss));

            //var rankedListFiltered = rankedList.Where(e => raidbosses.Contains(e.Pokemon.Id)).Take(limit);
            //return await Task.FromResult(rankedListFiltered.ToDictionary(k => k.Pokemon, v => v.Rank));
        }
 public DefaultProductNameMetricConfig()
 {
     InnerMetric        = new Levenstein();
     NameCleaningConfig = new DefaultMatchNameCleaningConfig();
     Tokeniser          = new TokeniserWhitespace();
     APositionalWeightingCoefficientPower = 1.5d;
     BPositionalWeightingCoefficientPower = 0d;
     ABCompoundPositionalWeightRatio      = 0d;
 }
        public async Task <Dictionary <IPokemon, double> > GetSimilarPokemonByNameAsync(string name, int limit = int.MaxValue)
        {
            var algorithm  = new Levenstein();
            var rankedList =
                Pokemon.Select(e => new { Pokemon = e, Rank = algorithm.GetSimilarity(e.Name, name) })
                .OrderByDescending(e => e.Rank)
                .Where(e => e.Rank > 0.1f)
                .Take(limit);

            return(await Task.FromResult(rankedList.ToDictionary(k => k.Pokemon, v => v.Rank)));
        }
Beispiel #5
0
        public int FindChannel(string Name, string country)
        {
            List <ChannelGrabberInfo> channels = GetChannelArrayList(country);


            int retChan = -1;

            if (channels == null)
            {
                return(retChan);
            }

            ChannelGrabberInfo ch;

            Levenstein comparer = new Levenstein();
            float      bestSimilarity;
            float      similarity;
            int        mostSimilarChan = -1;

            bestSimilarity = MIN_SIMILARITY;
            for (int i = 0; i < channels.Count; i++)
            {
                ch = (ChannelGrabberInfo)channels[i];
                if (ch.GrabberList == null)
                {
                    continue;
                }
                if (Name.Equals(ch.FullName, StringComparison.OrdinalIgnoreCase))
                {
                    retChan = i;
                    break;
                }

                if (ch.FullName.IndexOf(Name, StringComparison.OrdinalIgnoreCase) != -1)
                {
                    retChan = i;
                }

                similarity = comparer.getSimilarity(Name, ch.FullName);

                if (similarity > bestSimilarity)
                {
                    mostSimilarChan = i;
                    bestSimilarity  = similarity;
                }
            }

            if (retChan < 0)
            {
                return(mostSimilarChan);
            }

            return(retChan);
        }
Beispiel #6
0
 private string Similarity()
 {
     if (_migrationContainer.Destination != null && _migrationContainer.Source != null)
     {
         return(Levenstein.Percent(_migrationContainer.Source.CurrentWorksheetName,
                                   _migrationContainer.Destination.CurrentWorksheetName).ToString() + "%");
     }
     else
     {
         return("0%");
     }
 }
Beispiel #7
0
        protected override bool CheckResult(string consoleOut)
        {
            var lines    = consoleOut.Split(new string[] { "\r", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            var lastLine = lines[lines.Length - 1];

            if (RequiredAccuracy == 1)
            {
                // No differences allowed
                return(lastLine == ExpectedResult);
            }

            var comparer = new Levenstein();
            var accuracy = comparer.GetSimilarity(lastLine, ExpectedResult);

            return(accuracy >= RequiredAccuracy);
        }
Beispiel #8
0
        public ChannelGrabberInfo[] FindChannels(string[] NameList, string country)
        {
            List <ChannelGrabberInfo> channels = GetChannelArrayList(country);

            ChannelGrabberInfo[] retList = new ChannelGrabberInfo[NameList.Length];

            if (channels == null)
            {
                return(retList);
            }

            ChannelGrabberInfo ch;

            Levenstein comparer = new Levenstein();
            float      bestSimilarity;
            float      similarity;

            for (int k = 0; k < NameList.Length; k++)
            {
                bestSimilarity = MIN_SIMILARITY;
                for (int i = 0; i < channels.Count; i++)
                {
                    ch = (ChannelGrabberInfo)channels[i];
                    if (NameList[k] == ch.FullName)
                    {
                        retList[k] = ch;
                        break;
                    }

                    if (ch.FullName.IndexOf(NameList[k]) != -1)
                    {
                        retList[k] = ch;
                        break;
                    }

                    similarity = comparer.getSimilarity(NameList[k], ch.FullName);

                    if (similarity > bestSimilarity)
                    {
                        retList[k]     = ch;
                        bestSimilarity = similarity;
                    }
                }
            }
            return(retList);
        }
Beispiel #9
0
        private void DoLevenstein()
        {
            Levenstein lev = new Levenstein();

            switch (_newObjectName.NameType)
            {
            case FisheryObjectNameType.CatchLocalName:
                var localNameList = Names.LocalNameList;
                foreach (var item in localNameList)
                {
                    var similarity = lev.GetSimilarity(_newObjectName.NewName, item);
                }
                break;

            case FisheryObjectNameType.GearLocalName:
                break;
            }
        }
        protected override bool CheckResult(string consoleOut)
        {
            // Normalise new line characters
            var fixedConsoleOut     = consoleOut.Replace("\r\n", "\n").Trim();
            var fixedExpectedResult = ExpectedResult.Replace("\r\n", "\n").Trim();

            const int magicNUmber = 1;

            if (RequiredAccuracy == magicNUmber)
            {
                // No differences allowed
                return(fixedConsoleOut == fixedExpectedResult);
            }

            var comparer = new Levenstein();
            var accuracy = comparer.GetSimilarity(fixedConsoleOut, fixedExpectedResult);

            return(accuracy >= RequiredAccuracy);
        }
Beispiel #11
0
        public void FillSourceIfFoundDestination(ColumnParser parser, string caption)
        {
            if (_migration.Source.ColumnCaptionsWithIndexDictionary.ContainsKey(caption))
            {
                parser.SourceColumnName  = caption;
                parser.SourceColumnIndex = _migration.Source.ColumnCaptionsWithIndexDictionary[caption];
            }
            else
            {
                if (_migration.Source.ColumnCaptionsWithIndexDictionary.ContainsKey(caption))
                {
                    parser.SourceColumnName  = caption;
                    parser.SourceColumnIndex = _migration.Source.ColumnCaptionsWithIndexDictionary[caption.ToLower()];
                }
                else
                {
                    string highest = string.Empty;
                    int    memory  = 100;
                    foreach (var par in _migration.Source.ColumnCaptionList)
                    {
                        int distance = Levenstein.NettoDistance(par, caption);
                        if (distance < memory)
                        {
                            highest = par;
                            memory  = distance;
                        }
                    }

                    if (memory <= 3)
                    {
                        parser.SourceColumnName  = highest;
                        parser.SourceColumnIndex = _migration.Source.ColumnCaptionsWithIndexDictionary[highest];
                    }
                    else
                    {
                        var s = _migration.Source.ColumnCaptionsWithIndexDictionary.First();
                        parser.SourceColumnName  = s.Key;
                        parser.SourceColumnIndex = s.Value;
                    }
                }
            }
        }
Beispiel #12
0
        public static double ApproximatelyEquals(this string firstWord, string secondWord, SimMetricType simMetricType = SimMetricType.Levenstein)
        {
            switch (simMetricType)
            {
            case SimMetricType.BlockDistance:
                var sim2 = new BlockDistance();
                return(sim2.GetSimilarity(firstWord, secondWord));

            case SimMetricType.ChapmanLengthDeviation:
                var sim3 = new ChapmanLengthDeviation();
                return(sim3.GetSimilarity(firstWord, secondWord));

            case SimMetricType.CosineSimilarity:
                var sim4 = new CosineSimilarity();
                return(sim4.GetSimilarity(firstWord, secondWord));

            case SimMetricType.DiceSimilarity:
                var sim5 = new DiceSimilarity();
                return(sim5.GetSimilarity(firstWord, secondWord));

            case SimMetricType.EuclideanDistance:
                var sim6 = new EuclideanDistance();
                return(sim6.GetSimilarity(firstWord, secondWord));

            case SimMetricType.JaccardSimilarity:
                var sim7 = new JaccardSimilarity();
                return(sim7.GetSimilarity(firstWord, secondWord));

            case SimMetricType.Jaro:
                var sim8 = new Jaro();
                return(sim8.GetSimilarity(firstWord, secondWord));

            case SimMetricType.JaroWinkler:
                var sim9 = new JaroWinkler();
                return(sim9.GetSimilarity(firstWord, secondWord));

            case SimMetricType.MatchingCoefficient:
                var sim10 = new MatchingCoefficient();
                return(sim10.GetSimilarity(firstWord, secondWord));

            case SimMetricType.MongeElkan:
                var sim11 = new MongeElkan();
                return(sim11.GetSimilarity(firstWord, secondWord));

            case SimMetricType.NeedlemanWunch:
                var sim12 = new NeedlemanWunch();
                return(sim12.GetSimilarity(firstWord, secondWord));

            case SimMetricType.OverlapCoefficient:
                var sim13 = new OverlapCoefficient();
                return(sim13.GetSimilarity(firstWord, secondWord));

            case SimMetricType.QGramsDistance:
                var sim14 = new QGramsDistance();
                return(sim14.GetSimilarity(firstWord, secondWord));

            case SimMetricType.SmithWaterman:
                var sim15 = new SmithWaterman();
                return(sim15.GetSimilarity(firstWord, secondWord));

            case SimMetricType.SmithWatermanGotoh:
                var sim16 = new SmithWatermanGotoh();
                return(sim16.GetSimilarity(firstWord, secondWord));

            case SimMetricType.SmithWatermanGotohWindowedAffine:
                var sim17 = new SmithWatermanGotohWindowedAffine();
                return(sim17.GetSimilarity(firstWord, secondWord));

            case SimMetricType.ChapmanMeanLength:
                var sim18 = new ChapmanMeanLength();
                return(sim18.GetSimilarity(firstWord, secondWord));

            default:
                var sim1 = new Levenstein();
                return(sim1.GetSimilarity(firstWord, secondWord));
            }
        }
Beispiel #13
0
 private void Levenstein_button_Click(object sender, EventArgs e)
 {
     LevensteinRez.Text = Levenstein.Func(LevensteinText1.Text, LevensteinText2.Text).ToString();
 }
Beispiel #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            Existing_Method ex_m = new Existing_Method();
            Jaro            m1;
            JaroVincler     m2;
            Levenstein      m3;

            Stopwatch t = new Stopwatch();

            double[] rez_mas = new double[20];

            if (System.IO.File.Exists("data.txt"))
            {
                string[] mass = System.IO.File.ReadAllLines("data.txt");
                System.IO.File.WriteAllText("ex_m.txt", "");

                // Существующий тест
                t.Start();
                foreach (string s in mass)
                {
                    string[] str = s.Split(' ');
                    System.IO.File.AppendAllText("ex_m.txt", ex_m.IndistinctMatching(4, str[0], str[1]).ToString() + Environment.NewLine);
                }
                t.Stop();
                System.IO.File.AppendAllText("ex_m.txt", t.Elapsed.ToString());


                System.IO.File.WriteAllText("m1.txt", "");

                // Метод 1
                t = new Stopwatch();
                t.Start();
                foreach (string s in mass)
                {
                    string[] str = s.Split(' ');
                    m1 = new Jaro(str[0], str[1]);
                    System.IO.File.AppendAllText("m1.txt", (m1.Func() * 100).ToString() + Environment.NewLine);
                }
                t.Stop();
                System.IO.File.AppendAllText("m1.txt", t.Elapsed.ToString());


                System.IO.File.WriteAllText("m2.txt", "");

                // Метод 2
                t = new Stopwatch();
                t.Start();
                foreach (string s in mass)
                {
                    string[] str = s.Split(' ');
                    m2 = new JaroVincler(str[0], str[1]);
                    if (m2.Func())
                    {
                        System.IO.File.AppendAllText("m2.txt", "100" + Environment.NewLine);
                    }
                    else
                    {
                        System.IO.File.AppendAllText("m2.txt", "0" + Environment.NewLine);
                    }
                }
                t.Stop();
                System.IO.File.AppendAllText("m2.txt", t.Elapsed.ToString());

                // Метод 3
                System.IO.File.WriteAllText("m3.txt", "");

                t = new Stopwatch();
                t.Start();
                foreach (string s in mass)
                {
                    string[] str = s.Split(' ');
                    m3 = new Levenstein(str[0], str[1]);
                    System.IO.File.AppendAllText("m3.txt", (100 - m3.Func() * 100).ToString() + Environment.NewLine);
                }
                t.Stop();
                System.IO.File.AppendAllText("m3.txt", t.Elapsed.ToString());

                MessageBox.Show("Выполнено");
            }
        }
        public static DsDevice[] Sort(DsDevice[] devices, params object[] arg)
        {
            try
            {
                if (devices == null)
                {
                    return(devices);
                }
                if (devices.Length <= 1)
                {
                    return(devices);
                }
                List <string> compareNames = new List <string>();
                foreach (object obj in arg)
                {
                    String name = obj as String;
                    if (!string.IsNullOrEmpty(name))
                    {
                        compareNames.Add(name);
                        continue;
                    }
                    DsDevice dev = obj as DsDevice;
                    if (dev == null)
                    {
                        continue;
                    }
                    if (dev.Name == null)
                    {
                        continue;
                    }
                    if (dev.Name.Length == 0)
                    {
                        continue;
                    }
                    compareNames.Add(dev.Name);
                }
                if (compareNames.Count == 0)
                {
                    return(devices);
                }

                List <string> names = new List <string>();
                for (int i = 0; i < devices.Length; ++i)
                {
                    if (devices[i] == null)
                    {
                        continue;
                    }
                    if (devices[i].Name == null)
                    {
                        continue;
                    }
                    if (devices[i].Name.Length == 0)
                    {
                        continue;
                    }
                    names.Add(devices[i].Name);
                }

                //sort the devices based
                float[] results = new float[devices.Length + 20];
                for (int x = 0; x < results.Length; ++x)
                {
                    results[x] = 0.0f;
                }

                for (int i = 0; i < compareNames.Count; ++i)
                {
                    Levenstein comparer   = new Levenstein();
                    float[]    tmpResults = comparer.batchCompareSet(names.ToArray(), compareNames[i]);
                    for (int x = 0; x < tmpResults.Length; ++x)
                    {
                        results[x] += tmpResults[x];
                    }
                }
                List <SortItem> items = new List <SortItem>();
                for (int i = 0; i < devices.Length; ++i)
                {
                    SortItem item = new SortItem();
                    item.rate   = results[i];
                    item.device = devices[i];
                    items.Add(item);
                }
                items.Sort();
                DsDevice[] newDevices = new DsDevice[items.Count];

                int index = 0;
                foreach (SortItem item in items)
                {
                    newDevices[index] = item.device;
                    index++;
                }
                return(newDevices);
            }
            catch (Exception ex)
            {
                Log.Log.Write(ex);
                return(devices);
            }
        }
        // сравнение
        private List <string[]> Sravn(string[][] data)
        {
            List <string[]> rezlist = new List <string[]>();

            foreach (string[] str in data)
            {
                // количество слов в строке
                if (str.Count() != 2)
                {
                    continue;
                }
                else
                {
                    string[] mass;

                    SimMetricsMetricUtilities.Levenstein ex_l = new SimMetricsMetricUtilities.Levenstein();

                    Stopwatch t = new Stopwatch();
                    t.Start();
                    double rj1 = Math.Round(Jaro.Func(str[0], str[1]), 2);
                    string tj1 = Math.Round(t.Elapsed.TotalMilliseconds, 2).ToString();

                    t = new Stopwatch();
                    t.Start();
                    double rj2 = Math.Round(ExJaro.distance(str[0], str[1]), 2);
                    string tj2 = Math.Round(t.Elapsed.TotalMilliseconds, 2).ToString();

                    // -----

                    t = new Stopwatch();
                    t.Start();
                    double rjv1 = Math.Round(JaroVincler.Func(str[0], str[1]), 2);
                    string tjv1 = Math.Round(t.Elapsed.TotalMilliseconds, 2).ToString();

                    t = new Stopwatch();
                    t.Start();
                    double rjv2 = Math.Round(ExJaroWincler.distance(str[0], str[1]), 2);
                    string tjv2 = Math.Round(t.Elapsed.TotalMilliseconds, 2).ToString();

                    // ----

                    t = new Stopwatch();
                    t.Start();
                    double rl1 = Math.Round(Levenstein.Func(str[0], str[1]), 2);
                    string tl1 = Math.Round(t.Elapsed.TotalMilliseconds, 2).ToString();

                    t = new Stopwatch();
                    t.Start();
                    double rl2 = Math.Round(ex_l.GetSimilarity(str[0], str[1]), 2);
                    string tl2 = Math.Round(t.Elapsed.TotalMilliseconds, 2).ToString();

                    rezlist.Add(new string[14] {
                        rj1.ToString(), tj1, rj2.ToString(), tj2,
                        rjv1.ToString(), tjv1, rjv2.ToString(), tjv2,
                        rl1.ToString(), tl1, rl2.ToString(), tl2, str[0], str[1]
                    });
                }
            }

            return(rezlist);
        }
Beispiel #17
0
 public void Test1()
 {
     Assert.Equal(3, Levenstein.LevensteinDynamic("Вар", "Баран"));
 }
Beispiel #18
0
 public void Test3()
 {
     Assert.Equal(4, Levenstein.LevensteinDynamic("", "test"));
 }
Beispiel #19
0
        private void mpListViewChannels_SelectedIndexChanged(object sender, EventArgs e)
        {
            mpListViewMapped.BeginUpdate();
            try
            {
                mpListViewMapped.Items.Clear();
                if (mpListViewChannels.SelectedIndices == null)
                {
                    return;
                }
                if (mpListViewChannels.SelectedIndices.Count != 1)
                {
                    return;
                }
                Card                card            = ((CardInfo)mpComboBoxCard.SelectedItem).Card;
                ListViewItem        selectedItem    = mpListViewChannels.Items[mpListViewChannels.SelectedIndices[0]];
                Channel             selectedChannel = (Channel)selectedItem.Tag;
                IList <Channel>     allChannels     = Channel.ListAll();
                List <ListViewItem> items           = new List <ListViewItem>();
                NotifyForm          dlg             = new NotifyForm("Searching for Similar Channels...",
                                                                     "This can take some time\n\nPlease be patient...");
                dlg.Show(this);
                dlg.WaitForDisplay();
                foreach (Channel channel in allChannels)
                {
                    if (channel.IsRadio == false)
                    {
                        continue;
                    }

                    bool isMapped           = false;
                    IList <ChannelMap> list = channel.ReferringChannelMap();
                    foreach (ChannelMap map in list)
                    {
                        if (map.IdCard == card.IdCard)
                        {
                            isMapped = true;
                            break;
                        }
                    }
                    if (isMapped)
                    {
                        continue;
                    }

                    Levenstein comparer = new Levenstein();
                    float      result   = comparer.getSimilarity(selectedChannel.DisplayName, channel.DisplayName);

                    IList <TuningDetail> details = channel.ReferringTuningDetail();
                    int          imageIndex      = GetImageIndex(details);
                    ListViewItem item            = new ListViewItem((result * 100f).ToString("f2") + "%", imageIndex);
                    item.Tag = channel;
                    item.SubItems.Add(channel.DisplayName);
                    items.Add(item);
                }
                mpListViewMapped.Items.AddRange(items.ToArray());
                mpListViewMapped.Sort();
                dlg.Close();
            }
            finally
            {
                mpListViewMapped.EndUpdate();
            }
        }
Beispiel #20
0
        public bool ShouldCompareStringsPos(string s1, string s2, int level)
        {
            Levenstein algo = new Levenstein(level);

            return(algo.IsTheSame(s1, s2));
        }
Beispiel #21
0
        public double GetSimilarity(string str1, string str2, string type)
        {
            IStringMetric stringMetric;

            switch (type)
            {
            case AlgorithmTypes.BlockDistance:
                stringMetric = new BlockDistance();
                break;

            case AlgorithmTypes.ChapmanLengthDeviation:
                stringMetric = new ChapmanLengthDeviation();
                break;

            case AlgorithmTypes.ChapmanMeanLength:
                stringMetric = new ChapmanMeanLength();
                break;

            case AlgorithmTypes.CosineSimilarity:
                stringMetric = new CosineSimilarity();
                break;

            case AlgorithmTypes.DiceSimilarity:
                stringMetric = new DiceSimilarity();
                break;

            case AlgorithmTypes.EuclideanDistance:
                stringMetric = new EuclideanDistance();
                break;

            case AlgorithmTypes.JaccardSimilarity:
                stringMetric = new JaccardSimilarity();
                break;

            case AlgorithmTypes.Jaro:
                stringMetric = new Jaro();
                break;

            case AlgorithmTypes.JaroWinkler:
                stringMetric = new JaroWinkler();
                break;

            case AlgorithmTypes.Levenstein:
                stringMetric = new Levenstein();
                break;

            case AlgorithmTypes.MatchingCoefficient:
                stringMetric = new MatchingCoefficient();
                break;

            case AlgorithmTypes.MongeElkan:
                stringMetric = new MongeElkan();
                break;

            case AlgorithmTypes.NeedlemanWunch:
                stringMetric = new NeedlemanWunch();
                break;

            case AlgorithmTypes.OverlapCoefficient:
                stringMetric = new OverlapCoefficient();
                break;

            case AlgorithmTypes.QGramsDistance:
                stringMetric = new QGramsDistance();
                break;

            case AlgorithmTypes.SmithWaterman:
                stringMetric = new SmithWaterman();
                break;

            case AlgorithmTypes.SmithWatermanGotoh:
                stringMetric = new SmithWatermanGotoh();
                break;

            case AlgorithmTypes.SmithWatermanGotohWindowedAffine:
                stringMetric = new SmithWatermanGotohWindowedAffine();
                break;

            default:
                stringMetric = new SmithWatermanGotoh();
                break;
            }

            var similarity = stringMetric.GetSimilarity(str1.Trim(), str2.Trim());

            return(similarity);
        }
Beispiel #22
0
 // [SetUp]
 public LevensteinUnitTests()
 {
     LoadData();
     myLevenstein = new Levenstein();
 }
Beispiel #23
0
        private void MergeCheckTextMatch()
        {
            if (IsSecondKeyChecked() && IsKeyChecked())
            {
                var keycolumn = from el in columnParsers
                                where el.IsKey == true
                                select el;

                var matchcolumn = from el in columnParsers
                                  where el.LookupMatch == true
                                  select el;

                if (keycolumn.Count() != 1 || matchcolumn.Count() != 1)
                {
                    var msg = new MessageView("You cannot specify more than one first key!");
                    msg.Show();
                }
                else
                {
                    var keycol   = keycolumn.FirstOrDefault();
                    var matchcol = matchcolumn.FirstOrDefault();

                    Dictionary <string, int> sourceKeys      = new Dictionary <string, int>();
                    Dictionary <string, int> destinationKeys = new Dictionary <string, int>();

                    sourceKeys      = LoadColumn(_migration.Source, keycol.SourceColumnIndex);
                    destinationKeys = LoadColumn(_migration.Destination, keycol.DestinationColumnIndex);
                    SortedDictionary <string, int> sortedSourceKeys = new SortedDictionary <string, int>(sourceKeys);

                    Dictionary <string, int> sourceNames      = new Dictionary <string, int>();
                    Dictionary <string, int> destinationNames = new Dictionary <string, int>();

                    sourceNames      = LoadColumn(_migration.Source, matchcol.SourceColumnIndex);
                    destinationNames = LoadColumn(_migration.Destination, matchcol.DestinationColumnIndex);

                    int  ifNotFoundKeyRow = LastEmptyRow(_migration.Destination);
                    bool permission       = true;
                    int  row = 0;

                    int columncaptionsindex = _migration.Destination.ColumnCaptionRow;
                    foreach (var cl in sortedSourceKeys)
                    {
                        if (cl.Key != string.Empty)
                        {
                            if (destinationKeys.ContainsKey(cl.Key))
                            {
                                row = destinationKeys[cl.Key] + columncaptionsindex;
                                int     rowsource = sourceKeys[cl.Key] + columncaptionsindex;
                                decimal percent   = Levenstein.Percent(
                                    _migration.Source.ReadCell(rowsource, matchcol.SourceColumnIndex),
                                    _migration.Destination.ReadCell(row, matchcol.DestinationColumnIndex)
                                    );

                                if (percent < 80)
                                {
                                    var elements = from el in destinationNames
                                                   where Levenstein.NettoDistance(cl.Key, el.Key) <= 3 && el.Key != string.Empty
                                                   select el;

                                    if (elements.Count() > 0)
                                    {
                                        KeyValuePair <string, int> result = new KeyValuePair <string, int>();
                                        var comp = new SimilarNames(elements, result);
                                        comp.ShowDialog();
                                    }
                                }
                            }
                            else
                            {
                                row = ifNotFoundKeyRow++;
                            }

                            FromSource2DestinationWithRelationByRow(row,
                                                                    cl,
                                                                    sourceKeys,
                                                                    permission);
                        }
                    }

                    _migration.Destination.Save();
                    _migration.Source.Save();
                }
            }
        }