Warning: in the article there are headlines of real news. I treat them exclusively as a working material, I do not represent any point of view on the political or economic situation in any country.
sixteen; The government has made changes to the Kuril development program.
18; The Cabinet of Ministers has increased funding for the federal program for the development of the Kuril Islands
nineteen; The government has increased funding for the development of the Kuril Islands
6; Engineers have become the most popular in the labor market
12; Named the most popular profession in Russia
20; The most popular professions in Russia have become known.
26; Engineers are recognized as the most popular on the labor market in the Russian Federation
32; Engineers became the most popular on the labor market of the Russian Federation in September
51; Named the most popular profession in Russia
53; Ministry of Labor named the most popular professions in Russia
25; Sberbank since October 16, reduces the rate on consumer loans
31; Sberbank reduced interest rates for a number of loans
37; Sberbank reduced interest rates on a number of loans
0; Russia will release its own cryptocurrency - crypto-ruble
five; Russia urgently creates a crypto-ruble
27; In Russia, will be engaged in the release of crypto-ruble
35; Russia will create its own cryptocurrency
36; Russia will begin to produce crypto rubles
42; Russia will release its own cryptocurrency - crypto-ruble
/// <summary> /// : /// - /// - /// </summary> /// <param name="sentence">.</param> /// <returns> .</returns> private string NormalizeSentence(string sentence) { var resultContainer = new StringBuilder(100); var lowerSentece = sentence.ToLower(); foreach (var c in lowerSentece) { if (IsNormalChar(c)) { resultContainer.Append(c); } } return resultContainer.ToString(); } /// <summary> /// . /// </summary> /// <param name="c">.</param> /// <returns>True - , False - .</returns> private bool IsNormalChar(char c) { return char.IsLetterOrDigit(c) || c == ' '; }
/// <summary> /// . /// </summary> /// <param name="sentence">.</param> /// <returns> .</returns> private string[] GetTokens(string sentence) { var tokens = new List<string>(); var words = sentence.Split(' '); foreach (var word in words) { if (word.Length >= MinWordLength) { tokens.Add(word); } } return tokens.ToArray(); }
/// <summary> /// . /// </summary> /// <param name="firstToken"> .</param> /// <param name="secondToken"> .</param> /// <returns> .</returns> private bool IsTokensFuzzyEqual(string firstToken, string secondToken) { var equalSubtokensCount = 0; var usedTokens = new bool[secondToken.Length - SubtokenLength + 1]; for (var i = 0; i < firstToken.Length - SubtokenLength + 1; ++i) { var subtokenFirst = firstToken.Substring(i, SubtokenLength); for (var j = 0; j < secondToken.Length - SubtokenLength + 1; ++j) { if (!usedTokens[j]) { var subtokenSecond = secondToken.Substring(j, SubtokenLength); if (subtokenFirst.Equals(subtokenSecond)) { equalSubtokensCount++; usedTokens[j] = true; break; } } } } var subtokenFirstCount = firstToken.Length - SubtokenLength + 1; var subtokenSecondCount = secondToken.Length - SubtokenLength + 1; var tanimoto = (1.0 * equalSubtokensCount) / (subtokenFirstCount + subtokenSecondCount - equalSubtokensCount); return ThresholdWord <= tanimoto; }
/// <summary> /// . /// </summary> /// <param name="first"> .</param> /// <param name="second"> .</param> /// <returns> .</returns> public double CalculateFuzzyEqualValue(string first, string second) { if (string.IsNullOrWhiteSpace(first) && string.IsNullOrWhiteSpace(second)) { return 1.0; } if (string.IsNullOrWhiteSpace(first) || string.IsNullOrWhiteSpace(second)) { return 0.0; } var normalizedFirst = NormalizeSentence(first); var normalizedSecond = NormalizeSentence(second); var tokensFirst = GetTokens(normalizedFirst); var tokensSecond = GetTokens(normalizedSecond); var fuzzyEqualsTokens = GetFuzzyEqualsTokens(tokensFirst, tokensSecond); var equalsCount = fuzzyEqualsTokens.Length; var firstCount = tokensFirst.Length; var secondCount = tokensSecond.Length; var resultValue = (1.0 * equalsCount) / (firstCount + secondCount - equalsCount); return resultValue; } /// <summary> /// . /// </summary> /// <param name="tokensFirst"> .</param> /// <param name="tokensSecond"> .</param> /// <returns> .</returns> private string[] GetFuzzyEqualsTokens(string[] tokensFirst, string[] tokensSecond) { var equalsTokens = new List<string>(); var usedToken = new bool[tokensSecond.Length]; for (var i = 0; i < tokensFirst.Length; ++i) { for (var j = 0; j < tokensSecond.Length; ++j) { if (!usedToken[j]) { if (IsTokensFuzzyEqual(tokensFirst[i], tokensSecond[j])) { equalsTokens.Add(tokensFirst[i]); usedToken[j] = true; break; } } } } return equalsTokens.ToArray(); }
VTB lowered the minimum rate on cash loans
Sberbank reduced interest rates on a number of loans
Source: https://habr.com/ru/post/341148/
All Articles