// поиск буквенных ошибок в тексте public static List <WordError> SearchWordError(List <string> inputedText, List <string> OriginalText) { if (inputedText.Count != OriginalText.Count) { Console.WriteLine("error"); return(null); } List <WordError> ErrorWordList = new List <WordError>(); //List<char> errorList = new List<char>(); // проверка на совпадение символов int wordErrorCount = 0; int errorSimbols = 0; for (int i = 0; i < inputedText.Count; i++) { ErrorWordList.Add(new WordError(i)); for (int j = 0; j < inputedText[i].Length; j++) { ErrorWordList[wordErrorCount].SimbolError.Add(new ErrorSymbol(false)); if (inputedText[i][j] != OriginalText[i][j]) { //errorList.Add(inputedText[i][j]); ErrorSymbol ES = new ErrorSymbol(j, OriginalText[i][j]); ErrorWordList[wordErrorCount].SimbolError[j] = ES; //add ErrorWordList[wordErrorCount].Iserror = true; ErrorWordList[wordErrorCount].SimbolError[j].IserrorS = true; //errorsymbol errorSimbols++; } } errorSimbols = 0; wordErrorCount++; } return(ErrorWordList); }
// поиск ошибок запятых public static List <WordError> SearchCommaError(List <string> inputedText, List <string> OriginalText) { if (inputedText.Count != OriginalText.Count) { Console.WriteLine("error"); //return null; } List <WordError> ErrorCommaList = new List <WordError>(); int wordCommaCount = 0; for (int i = 0; i < inputedText.Count; i++) { //добавление нового объекта ошибочное слово ErrorCommaList.Add(new WordError(i)); //for (int j = 0; j < inputedText[i].Length; j++) //{ //OriginalText[i].Length - 1 if (inputedText[i][inputedText[i].Length - 1] != OriginalText[i][OriginalText[i].Length - 1] && (OriginalText[i][OriginalText[i].Length - 1] == ',' || inputedText[i][inputedText[i].Length - 1] == ',')) { ErrorSymbol ES = new ErrorSymbol(OriginalText[i].Length - 1, OriginalText[i][OriginalText[i].Length - 1]); ErrorCommaList[wordCommaCount].SimbolError.Add(ES); ErrorCommaList[wordCommaCount].Iserror = true; //////////////////////////////////////////// } wordCommaCount++; } //Console.WriteLine(ErrorCommaList[0].WordNumber + ":" + ErrorCommaList[0].SimbolError[0].SymbolNumber + ":" + ErrorCommaList[0].SimbolError[0].Symbol); return(ErrorCommaList); }