public static void Main(string[] args) { EditDistance.WriteDistance("пример", "1пример"); EditDistance.WriteDistance("пример", "1пр23имер"); EditDistance.WriteDistance("пример", "1прим54ер"); EditDistance.WriteDistance("пример", "1при33222мер"); }
public void NullOrEmptyStringsDistanceCheck() { string s1 = null; string s2 = "test"; Assert.IsTrue(EditDistance.DamerauLevenshteinDistance(s1, s2) == s2.Length); var temp = s1; s1 = s2; s2 = temp; Assert.IsTrue(EditDistance.DamerauLevenshteinDistance(s1, s2) == s1.Length); s2 = string.Empty; Assert.IsTrue(EditDistance.DamerauLevenshteinDistance(s1, s2) == s1.Length); temp = s1; s1 = s2; s2 = temp; Assert.IsTrue(EditDistance.DamerauLevenshteinDistance(s1, s2) == s2.Length); s1 = null; s2 = string.Empty; Assert.IsTrue(EditDistance.DamerauLevenshteinDistance(s1, s2) == 0); temp = s1; s1 = s2; s2 = temp; Assert.IsTrue(EditDistance.DamerauLevenshteinDistance(s1, s2) == 0); }
/// <summary> /// Выполняется в параллельном потоке для поиска строк /// </summary> public static List <ParallelSearchResult> ArrayThreadTask(object paramObj) { ParallelSearchThreadParam param = (ParallelSearchThreadParam)paramObj; //Слово для поиска в верхнем регистре string wordUpper = param.wordPattern.Trim().ToUpper(); //Результаты поиска в одном потоке List <ParallelSearchResult> Result = new List <ParallelSearchResult>(); //Перебор всех слов во временном списке данного потока foreach (string str in param.tempList) { //Вычисление расстояния Дамерау-Левенштейна int dist = EditDistance.Distance(str.ToUpper(), wordUpper); //Если расстояние меньше порогового, то слово добавляется в результат if (dist <= param.maxDist) { ParallelSearchResult temp = new ParallelSearchResult() { word = str, dist = dist, ThreadNum = param.ThreadNum }; Result.Add(temp); } } return(Result); }
public void Top1000Test() { for (var i = 0; i < Top1000.Length; i++) { var source = Top1000[i]; for (var j = 0; j < Top1000.Length; j++) { var target = Top1000[j]; var editDistance1 = EditDistance.GetEditDistance(source, target); if (i == j) { Assert.Equal(0, editDistance1); } if (editDistance1 == 0) { Assert.Equal(i, j); } Assert.True(editDistance1 >= 0); var editDistance2 = EditDistance.GetEditDistance(source, target, editDistance1); Assert.Equal(editDistance1, editDistance2); } } }
private void button1_Click(object sender, EventArgs e) { string word = this.word_input.Text.Trim(); if (!string.IsNullOrWhiteSpace(word) && list.Count > 0) { // к верхнему string word_upregist = word.ToUpper(); List <string> words_result = new List <string>(); Stopwatch timer = new Stopwatch(); timer.Start(); foreach (string str in list) { // сравнение расстояния и добавление if (EditDistance.Distance(word_upregist, str.ToUpper()) <= int.Parse(distance_box.Text)) { words_result.Add(str); } } timer.Stop(); this.search_time.Text = timer.Elapsed.ToString(); // вывод результатов this.result_box.BeginUpdate(); this.result_box.Items.Clear(); foreach (string str in words_result) { this.result_box.Items.Add(str); } this.result_box.EndUpdate(); } else { MessageBox.Show("Необходимо выбрать файл и ввести слово для поиска"); } }
public void EditDistance11() { var editDistance = EditDistance.GetEditDistance("book", "moons", 1); Assert.Equal(editDistance, EditDistance.BeyondThreshold); VerifyEditDistance("book", "moons", 3); }
public void TestTriangleInequality() { var top = Top1000.Take(50).ToArray(); for (var i = 0; i < top.Length; i++) { for (var j = 0; j < top.Length; j++) { if (j == i) { continue; } for (var k = 0; k < top.Length; k++) { if (k == i || k == j) { continue; } var string1 = top[i]; var string2 = top[j]; var string3 = top[k]; var editDistance12 = EditDistance.GetEditDistance(string1, string2); var editDistance13 = EditDistance.GetEditDistance(string1, string3); var editDistance23 = EditDistance.GetEditDistance(string2, string3); Assert.True(editDistance13 <= editDistance12 + editDistance23); } } } }
//public DecayingDouble AllFailures(TimeSpan halfLife) => AccountFailures.Add(halfLife, PasswordFailures); //public DecayingDouble AccountFailuresSubsetWithInfrequentPassword(TimeSpan halfLife) => AccountFailures.Subtract(halfLife, AccountFailuresSubsetWithFrequentPassword); //public DecayingDouble PasswordFailuresSubsetWithInfrequentPassword(TimeSpan halfLife) => PasswordFailures.Subtract(halfLife, PasswordFailuresSubsetWithFrequentPassword); //public DecayingDouble PasswordFailuresSubsetWithoutTypo(TimeSpan halfLife) => PasswordFailures.Subtract(halfLife, PasswordFailuresSubsetWithTypo); //public DecayingDouble PasswordFailuresSubsetWithoutEitherFrequentPasswordOrTypo(TimeSpan halfLife) => PasswordFailures.Subtract(halfLife, PasswordFailuresSubsetWithTypoAndFrequentPassword); /// <summary> /// This analysis will examine the client IP's previous failed attempts to login to this account /// to determine if any failed attempts were due to typos. /// </summary> /// <param name="account">The account that the client is currently trying to login to.</param> /// <param name="whenUtc"></param> /// <param name="correctPassword">The correct password for this account. (We can only know it because /// the client must have provided the correct one this loginAttempt.)</param> /// <returns></returns> public void AdjustBlockingScoreForPastTyposTreatedAsFullFailures( Simulator simulator, SimulatedUserAccount account, DateTime whenUtc, string correctPassword) { SimLoginAttemptSummaryForTypoAnalysis[] recentPotentialTypos = RecentPotentialTypos.MostRecentFirst.ToArray(); foreach (SimLoginAttemptSummaryForTypoAnalysis potentialTypo in recentPotentialTypos) { if (account == null || potentialTypo.UsernameOrAccountId != account.UsernameOrAccountId) { continue; } // Use an edit distance calculation to determine if it was a likely typo bool likelyTypo = EditDistance.Calculate(potentialTypo.Password, correctPassword) <= simulator._experimentalConfiguration.BlockingOptions.MaxEditDistanceConsideredATypo; TimeSpan halfLife = simulator._experimentalConfiguration.BlockingOptions.BlockScoreHalfLife; DecayingDouble value = new DecayingDouble(1d, potentialTypo.WhenUtc); // Add this to the list of changed attempts if (potentialTypo.WasPasswordFrequent) { PasswordFailuresNoTypoFrequentPassword.SubtractInPlace(halfLife, value); PasswordFailuresTypoFrequentPassword.AddInPlace(halfLife, value); } RecentPotentialTypos.Remove(potentialTypo); } }
public int GoogleSearch(string phrase, string error, out string suggestion) { suggestion = ""; int hits = 0; string url = string.Format("https://www.google.co.id/search?q=\"{0}\"", phrase.Trim()); Random r = new Random(); int interval = r.Next(5000, 9000); Thread.Sleep(interval); using (ChromeDriver driver = new ChromeDriver(SeleniumFolder)) { driver.Navigate().GoToUrl(url); try { int.TryParse(Regex.Replace(driver.FindElement(By.XPath("//div[@id=\"resultStats\"]")).Text, "[^0-9]", ""), out hits); } catch { } try { IWebElement noresultNode = driver.FindElement(By.XPath("//div[@id=\"topstuff\"]")); if (noresultNode.Text.StartsWith("Hasil untuk") && noresultNode.Text.Contains("tidak ditemukan")) { hits = 0; } } catch { } try { IWebElement spellNode = driver.FindElement(By.XPath("//a[@class=\"spell\"]")); var tmpA = spellNode.GetAttribute("innerHTML").Replace(""", ""); string[] arrTmp = Regex.Split(tmpA, "<b><i>"); Dictionary <string, int> candidates = new Dictionary <string, int>(); foreach (string tmp in arrTmp) { if (tmp.Trim().Contains("</i></b>")) { int posAkhir = tmp.Trim().IndexOf("</i></b>"); string nline = tmp.Trim().Substring(0, posAkhir); int levenshtein = EditDistance.LevenshteinDistance(nline, error, 4); if (levenshtein != -1 && levenshtein <= 4) { candidates.Add(nline, levenshtein); } } } if (candidates.Count > 1) { var temp = candidates.OrderBy(p => p.Value).ToDictionary(p => p.Key, p => p.Value); suggestion = temp.First().Key; } if (candidates.Count == 1) { suggestion = candidates.First().Key; } } catch { } } return(hits); }
public void TestCloseMatch() { Assert.True(EditDistance.IsCloseMatch("variabledeclaratorsyntax", "variabledeclaratorsyntaxextensions")); Assert.True(EditDistance.IsCloseMatch("expressionsyntax", "expressionsyntaxextensions")); Assert.True(EditDistance.IsCloseMatch("expressionsyntax", "expressionsyntaxgeneratorvisitor")); }
public void LongestCommonSubstring1() { Assert.Equal(EditDistance.GetLongestCommonSubsequenceLength("a", "a"), 1); Assert.Equal(EditDistance.GetLongestCommonSubsequenceLength("ab", "a"), 1); Assert.Equal(EditDistance.GetLongestCommonSubsequenceLength("a", "ab"), 1); Assert.Equal(EditDistance.GetLongestCommonSubsequenceLength("ba", "ab"), 1); Assert.Equal(EditDistance.GetLongestCommonSubsequenceLength("foo", "arf"), 1); }
private void buttonSeach_Click(object sender, EventArgs e) { string word = this.textBoxFind.Text.Trim(); //введенное слово для поиска if (!string.IsNullOrWhiteSpace(word) && list.Count > 0) //если слово не пустое { int kol; if (!int.TryParse(this.TextBoxKol.Text.Trim(), out kol)) { MessageBox.Show("Необходимо указать максимальное расстояние"); return; } if (kol < 1 || kol > 5) { MessageBox.Show("Масксимальное расстояние должно быть больше 1 и меньше 5"); return; } string wordUp = word.ToUpper(); //перевели в верхний регистр List <string> tempList = new List <string>(); //пустой массив для найденных слов Stopwatch t = new Stopwatch(); t.Start(); //начали отсчет foreach (string i in list) { if (EditDistance.Distance(i.ToUpper(), wordUp) <= kol) // если растояние меньше указанного, то { tempList.Add(i); //записываем во временный список } } t.Stop(); this.labelTime2.Text = (t.ElapsedTicks * 0.0001).ToString(); this.listBoxResults.Items.Clear(); //очистили список (чтоб не показывал предыдущие результаты) this.listBoxResults.BeginUpdate(); foreach (string i in tempList) { this.listBoxResults.Items.Add(i); } this.listBoxResults.EndUpdate(); } else { MessageBox.Show("Нужно ввести слово для поиска"); } }
public void EditDistance1() { Assert.Equal(EditDistance.GetEditDistance("", "a"), 1); Assert.Equal(EditDistance.GetEditDistance("a", ""), 1); Assert.Equal(EditDistance.GetEditDistance("a", "b"), 1); Assert.Equal(EditDistance.GetEditDistance("ab", "a"), 1); Assert.Equal(EditDistance.GetEditDistance("a", "ab"), 1); Assert.Equal(EditDistance.GetEditDistance("aabb", "abab"), 1); }
public void EditDistance3() { Assert.Equal(EditDistance.GetEditDistance("", "aaa"), 3); Assert.Equal(EditDistance.GetEditDistance("aaa", ""), 3); Assert.Equal(EditDistance.GetEditDistance("aaa", "bbb"), 3); Assert.Equal(EditDistance.GetEditDistance("aaab", "a"), 3); Assert.Equal(EditDistance.GetEditDistance("a", "aaab"), 3); Assert.Equal(EditDistance.GetEditDistance("aababbab", "abababaa"), 3); }
private void search_distance_threads_Click(object sender, EventArgs e) { if (int.Parse(thread_count.Text) == 0) { MessageBox.Show("введите количество потоков"); } else { string word = this.word_input.Text.Trim(); if (!string.IsNullOrWhiteSpace(word) && list.Count > 0) { Stopwatch timer = new Stopwatch(); timer.Start(); // переход в верхний регистр string word_upregist = word.ToUpper(); List <string> words_result = new List <string>(); // поиск в списке List <MinMax> arrayDivList = DivideSubArrays(0, list.Count, int.Parse(thread_count.Text)); int count = arrayDivList.Count; Task[] tasks = new Task[count]; for (int i = 0; i < count; i++) { //создание тасков List <string> tasklist = list.GetRange(arrayDivList[i].Min, arrayDivList[i].Max - arrayDivList[i].Min); tasks[i] = new Task(() => { foreach (string str in tasklist) { // сравнение расстояния и добавление if (EditDistance.Distance(word_upregist, str.ToUpper()) <= int.Parse(distance_box.Text)) { words_result.Add(str); } } } ); tasks[i].Start(); } Task.WaitAll(tasks); timer.Stop(); this.distance_time.Text = timer.Elapsed.ToString(); // вывод результатов this.result_box.BeginUpdate(); this.result_box.Items.Clear(); foreach (string str in words_result) { this.result_box.Items.Add(str); } this.result_box.EndUpdate(); } else { MessageBox.Show("Необходимо выбрать файл и ввести слово для поиска"); } } }
public static Tuple <List <Edit>, List <Edit> > SplitEditsByRootsAndNonRoots(EditDistance editDistance) { var roots = new List <Edit>(); var nonroots = new List <Edit>(); foreach (var edit in editDistance.Edits) { var isRoot = true; //check if the target node is a resulting node of another edit. If so, //this edit is not root foreach (var edit1 in editDistance.Edits) { if (edit1.Equals(edit)) { continue; } if (edit.TargetNode.Equals(edit1.ModifiedNode)) { isRoot = false; break; } if (edit is Update && edit1 is Insert) { foreach (var child in edit1.ModifiedNode.Children) { if (edit.ModifiedNode.Equals(child)) { isRoot = false; break; } } } } //if the edit is performed on an node in the input tree //add it as a root edit. Otherwise, it is a nonroot edit, //that is, an edit that belongs to a parent edit. if (isRoot) { if (edit is Insert) { var insert = (Insert)edit; insert.TargetNode = editDistance.Mapping[insert.TargetNode]; insert.Index = insert.ModifiedNode.Parent.Children.IndexOf(insert.ModifiedNode); } roots.Add(edit); } else { nonroots.Add(edit); } } return(Tuple.Create(roots, nonroots)); }
public void EditDistanceDPTest(string str1, string str2, int expected) { // Arrange // Act int dist = EditDistance.EditDistDP(str1, str2, str1.Length, str2.Length); // Assert Assert.AreEqual(dist, expected); }
public void ThirdMaxTests() { EditDistance obj = new EditDistance(); var x = obj.MinDistance("sea", "eat"); //2 x = obj.MinDistance("a", "ab"); //1 x = obj.MinDistance("park", "spake"); //3 }
public async Task CheapestRestaurants(IDialogContext context, IAwaitable <IMessageActivity> argument) { var message = await argument; string loc = ""; if (message.Text.ToLower() == "no") { await context.PostAsync("I hope i was helful \n Enjoy the rest!!!"); SpeechSynthesizer sound = new SpeechSynthesizer(); //Add System.Speech Reference First In Order To Creating It. sound.Speak("I hope i was helful \n Enjoy the rest"); context.Wait(redirect); } else if (loc != null) { EditDistance distance = new EditDistance(message.Text); loc = distance.Location(); SqlConnection connection = new SqlConnection("Data Source=CHRISTOS\\SQLEXPRESS;Initial Catalog=Tourist;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); connection.Open(); cmd = new SqlCommand(" select * from Restaurant Where City ='" + loc.ToUpper() + "' ORDER BY Price_rate ASC ", connection); SqlDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { await context.PostAsync("The district that you provide does not exist. \n Please try again!!"); context.Wait(CheapestRestaurants); } else { await context.PostAsync("Here is the cheapest restaurants in order....."); while (reader.Read()) { String msg = " Restaurant Name: " + reader[1].ToString() + "\nCity: " + reader[2].ToString() + "\nAddress: " + reader[3].ToString() + "\nPricing rate: " + reader[6].ToString() + "/5"; await context.PostAsync(msg); } await Task.Delay(5000); await context.PostAsync("Do you want any other district??"); context.Wait(CheapestRestaurants); } } }
void DoTest(string s1, string s2, string expected, Func <char, char, int> cost) { var(dist, edits) = EditDistance.GetEditDistance( s1.ToList(), s2.ToList(), cost ); string actual = $"{dist} {string.Join(",", edits.Select(e => e))}"; Assert.AreEqual(expected, actual); }
/// <summary> /// this is the function you implement. /// </summary> /// <param name="sequenceA">the first sequence</param> /// <param name="sequenceB">the second sequence, may have length not equal to the length of the first seq.</param> /// <param name="banded">true if alignment should be band limited.</param> /// <returns>the alignment score and the alignment (in a Result object) for sequenceA and sequenceB. The calling function places the result in the display appropriately. /// public ResultTable.Result Align_And_Extract(GeneSequence sequenceA, GeneSequence sequenceB, bool banded) { ResultTable.Result result = new ResultTable.Result(); int score; // place your computed alignment score here string[] alignment = new string[2]; // place your two computed alignments here int sub = MaxCharactersToAlign; if (sequenceA.Sequence.Length < sub) { sub = sequenceA.Sequence.Length; } int sub2 = MaxCharactersToAlign; if (sequenceB.Sequence.Length < sub2) { sub2 = sequenceB.Sequence.Length; } // ********* these are placeholder assignments that you'll replace with your code ******* score = int.MaxValue; alignment[0] = "No Alignment Possible"; alignment[1] = "No Alignment Possible"; EditDistance editor; if (banded) { if (Math.Abs(sub2 - sub) > Bandwidth) { result.Update(score, alignment[0], alignment[1]); // bundling your results into the right object type return(result); } editor = new EditDistance(sequenceA.Sequence.Substring(0, sub), sequenceB.Sequence.Substring(0, sub2)); editor.setupBanded(); //Console.WriteLine(editor.toString()); alignment = editor.bandedResults(); //Console.WriteLine(editor.toString()); score = editor.value(); } else { editor = new EditDistance(sequenceA.Sequence.Substring(0, sub), sequenceB.Sequence.Substring(0, sub2)); editor.setupUnbanded(); alignment = editor.results(); score = editor.value(); } // *************************************************************************************** result.Update(score, alignment[0], alignment[1]); // bundling your results into the right object type return(result); }
public async Task RestaurantsInfo(IDialogContext context, IAwaitable <IMessageActivity> argument) { var message = await argument; string loc = ""; if (message.Text.ToLower() == "no") { await context.PostAsync("Have a nice day!!!"); } else if (message.Text.ToLower() == "yes") { context.Wait(RestaurantsInfo); } else if (loc != null) { EditDistance distance = new EditDistance(message.Text); loc = distance.Location(); SqlConnection connection = new SqlConnection("Data Source=CHRISTOS\\SQLEXPRESS;Initial Catalog=Tourist;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); connection.Open(); cmd = new SqlCommand("SELECT * FROM Restaurant WHERE City = '" + loc.ToLower() + "'", connection); SqlDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { await context.PostAsync("The district that you provide does not exist \n Please try again!!"); context.Wait(CheapestRestaurants); } else { await context.PostAsync("Here is my recommendations....."); while (reader.Read()) { String msg = " Restaurant Name: " + reader[1].ToString() + "\nAddress :" + reader[2].ToString() + "\nCity: " + reader[3].ToString() + "\nPhone: " + reader[4].ToString() + "\n Rate:" + reader[5].ToString() + "/5"; await context.PostAsync(msg); } await Task.Delay(6000); await context.PostAsync("Do you want any other district??"); } } }
private void button2_Click(object sender, EventArgs e) { //Слово для поиска string word = this.textBoxFind.Text.Trim(); //Если слово для поиска не пусто if (!string.IsNullOrWhiteSpace(word) && list.Count > 0) { int maxDist; if (!int.TryParse(this.textBoxMaxDist.Text.Trim(), out maxDist)) { MessageBox.Show("Необходимо указать максимальное расстояние"); return; } if (maxDist < 1 || maxDist > 5) { MessageBox.Show("Максимальное расстояние должно быть в диапазоне от 1 до 5"); return; } //Слово для поиска в верхнем регистре string wordUpper = word.ToUpper(); //Временные результаты поиска List <Tuple <string, int> > tempList = new List <Tuple <string, int> >(); Stopwatch t = new Stopwatch(); t.Start(); foreach (string str in list) { //Вычисление расстояния Дамерау-Левенштейна int dist = EditDistance.Distance(str.ToUpper(), wordUpper); //Если расстояние меньше порогового, то слово добавляется в результат if (dist <= maxDist) { tempList.Add(new Tuple <string, int>(str, dist)); } } t.Stop(); //this.textBoxApproxTime.Text = t.Elapsed.ToString(); this.listBoxResult.BeginUpdate(); //Очистка списка this.listBoxResult.Items.Clear(); //Вывод результатов поиска foreach (var x in tempList) { string temp = x.Item1 + " (расстояние = " + x.Item2.ToString() + ")"; this.listBoxResult.Items.Add(temp); } this.listBoxResult.EndUpdate(); } else { MessageBox.Show("Необходимо выбрать файл и ввести слово для поиска"); } }
private static void UpdateIds(List <PythonNode> children, EditDistance editDistance) { foreach (var pythonNode in children) { if (editDistance.Mapping.ContainsKey(pythonNode)) { var mapped = editDistance.Mapping[pythonNode]; pythonNode.Id = mapped.Id; } UpdateIds(pythonNode.Children, editDistance); } }
public void ReversedStringsDistanceCheck() { string s1 = "asdfghjkl"; string s2 = "lkjhgfdsa"; // Expected length - 1, because one char is on the same place (odd number of chars) Assert.IsTrue(EditDistance.LevenshteinDistance(s1, s2) == s1.Length - 1); s1 = "qazwsxedcrfv"; s2 = "vfrcdexswzaq"; Assert.IsTrue(EditDistance.LevenshteinDistance(s1, s2) == s1.Length); }
static void Main(string[] args) { string str1 = "intention"; string str2 = "execution"; EditDistance ed = new EditDistance(); int num = ed.editDistance(str1.ToCharArray(), str2.ToCharArray()); Console.WriteLine(num); Console.ReadKey(); }
protected internal override Boolean IsNeglectHeader(ReadOnlySpan<Char> source, Int32 location) => true; // The first char could always be the edit, so this is always true. /// <inheritdoc/> protected internal override void Neglect(ReadOnlySpan<Char> source, ref Int32 location, [AllowNull, MaybeNull] out Exception exception, [AllowNull] IAdd<Capture> trace) { if (location + String.Length > source.Length) { exception = AtEnd; trace?.Add(exception, location); } else if (EditDistance.Hamming(String, source.Slice(location, String.Length), Casing) > MaxEdits) { trace?.Add(source.Slice(location, String.Length), location); location += String.Length; exception = null; } else { exception = NoMatch; trace?.Add(exception, location); } }
public void DifferentLengthStringsDistanceCheck() { string s1 = "short string"; string s2 = "long string, but not so much"; // Expected length - 7, because we have 7 consecutive chars that are the same in both strings Assert.IsTrue(EditDistance.DamerauLevenshteinDistance(s1, s2) == s2.Length - 7); s1 = "another one"; s2 = "and another one"; // Expected 4, because 4 chars from the second are not present in the first Assert.IsTrue(EditDistance.DamerauLevenshteinDistance(s1, s2) == 4); }
public void GetEditDistance_Returns0_GivenIdenticalStrings() { //Arrange string first = "Some string!"; string second = "Some string!"; int expected = 0; //Act int actual = EditDistance.GetEditDistance(first, second); //Assert Assert.AreEqual(expected, actual); }
public void GetEditDistance_Returns5_GivenLongerStringTop() { //Arrange string first = "Some string!12345"; string second = "Some string!"; int expected = 5; //Act int actual = EditDistance.GetEditDistance(first, second); //Assert Assert.AreEqual(expected, actual); }
public override double GetCost(string tokenA, string tokenB) { if (tokenA != string.Empty && tokenB != string.Empty) { var editDistance = new EditDistance(tokenA, tokenB).Distance(); if (editDistance == 1) { return editDistance * 1/*IDFProvider.Frequency(tokenA, 0) + MatchOffset*/; } else { return editDistance * 1/*IDFProvider.Frequency(tokenA, 0) + NonMatchOffset*/; } } else if (tokenA == string.Empty) { return InsertionFactor * 1/*IDFProvider.Frequency(tokenB, 0) + InsertionOffset*/; } else { return 1/*IDFProvider.Frequency(tokenA, 0)*/ + DeletionOffset; } }