project.Lists["list"].Clear();
var inputstring = "";
string texttostring = "";
int count = 0;
string pattern = "";
int i = 0;
string input = "";
string[] words = null;
//Подсчет слов в переменной до удаление
pattern = "[^\\w]";
//get all spaces and other signs, like: '.' '?' '!'
input = project.Variables["txt5"].Value;
words = null;
i = 0;
count = 0;
words = Regex.Split(input, pattern, RegexOptions.IgnoreCase);
for (i = words.GetLowerBound(0); i <= words.GetUpperBound(0); i++) {
if (words[i].ToString() == string.Empty)
count = count - 1;
count = count + 1;
}
double LenghtWord = count;
// Текст который будет убираться в список
string text = project.ExecuteMacro(project.Variables["txt5"].Value);
// Перемещаем в список с разделителем пробел
Macros.TextProcessing.ToList(text, " ", "Regex", project, project.Lists["list"]);
//Удаление всех одинаковых слов
var list = project.Lists["list"];
var buffer = (from q in list
group q by q into l
where l.Count() == 1
select l.Key).ToList();
list.Clear();
list.AddRange(buffer);
project.Variables["DublicateA"].Value = string.Join(" ", project.Lists["list"]);
//Подсчет слов в переменной после удаления
pattern = "[^\\w]";
//get all spaces and other signs, like: '.' '?' '!'
input = project.Variables["DublicateA"].Value;
words = null;
i = 0;
count = 0;
words = Regex.Split(input, pattern, RegexOptions.IgnoreCase);
for (i = words.GetLowerBound(0); i <= words.GetUpperBound(0); i++) {
if (words[i].ToString() == string.Empty)
count = count - 1;
count = count + 1;
}
double Percent = 100 - (100 / LenghtWord * count);
return Percent;