public void Write(List <TestResult> results) { _statusDisplay.SetText("Writing words results"); _statusDisplay.SetTotal(results.Count); using (var writer = new StreamWriter(_fileName)) { var row = 1; var line = new StringBuilder(); writer.WriteLine("#~F~T~V~W~WSyC~WCC~WANCC"); _statusDisplay.SetTotal(results.Select(result => result.WordCount).Sum()); results.ForEach(result => { result.Sentences.ForEach(sentence => { sentence.Words.ForEach(word => { _statusDisplay.UpdateCount(row); line.Append($"{row++}~"); // # line.Append($"\"{result.FormulaName}\"~"); // F line.Append($"\"{result.Title}\"~"); // T line.Append($"\"{result.Sample.Variant}\"~"); // V line.Append($"\"{word.Content}\"~"); // W line.Append($"{word.SyllableCount}~"); // WSyC line.Append($"{word.CharacterCount}~"); // WCC line.Append($"{word.AlphaNumericCharacterCount}"); // WANCC writer.WriteLine(line); line.Clear(); }); }); }); writer.Flush(); writer.Close(); } }
public void Write(List <TestResult> results) { _statusDisplay.SetText("Writing sentence results"); using (var writer = new StreamWriter(_fileName)) { var row = 1; var line = new StringBuilder(); _statusDisplay.SetTotal(results.Select(sentence => sentence.Sentences.Count()).Sum()); writer.WriteLine("#~F~T~V~SWC~TSyC~SSyC~SCC~SANCC~LN~ST"); results.ForEach(result => { result.Sentences.ForEach(sentence => { _statusDisplay.UpdateCount(row); line.Append($"{row}~"); // # line.Append($"\"{result.FormulaName}\"~"); // F line.Append($"\"{result.Title}\"~"); // T line.Append($"\"{result.Sample.Variant}\"~"); // V line.Append($"{sentence.Words.Count}~"); //SWC line.Append($"{result.SyllableCount}~"); // TSyC line.Append($"{sentence.SyllableCount}~"); // SSyC line.Append($"{sentence.CharacterCount}~"); // SCC line.Append($"{sentence.AlphaNumericCharacterCount}~"); // SANCC line.Append($"\"{sentence.LineNumber}\"~"); // LN line.Append($"\"{sentence.Content}\""); // ST writer.WriteLine(line); line.Clear(); row += 1; }); }); writer.Flush(); writer.Close(); } }
public void Write(List <TestResult> results) { _statusDisplay.SetText("Writing cumulative results"); using (var writer = new StreamWriter(_fileName)) { writer.WriteLine(@"#~F~T~V~S~TSC~TWC~TSyC~TCC~TANCC~TAWS~TACCSW~TACCW~LC~CW~ASW~SSyC~SWC~SCC~SANCC~LN~ST~WT~WSy~WCC~WANCC"); var line = new StringBuilder(); var rowCount = results.Sum(rw => rw.Sentences.Sum(w => w.Words.Count)); _statusDisplay.SetTotal(rowCount); var cursorX = Console.CursorLeft; var cursorY = Console.CursorTop; var row = 1; results.ForEach(formula => { formula.Sentences.ForEach(sentence => { sentence.Words.ForEach(word => { _statusDisplay.UpdateCount(row); line.Append($"{row}~"); line.Append($"\"{formula.FormulaName}\"~"); // F line.Append($"\"{formula.Title}\"~"); // T line.Append($"\"{ formula.Sample.Variant}\"~"); // V line.Append($"{formula.Score}~"); // S line.Append($"{formula.Sentences.Count}~"); //TSC line.Append($"{formula.WordCount}~"); // TWC line.Append($"{formula.SyllableCount}~"); // TSyC line.Append($"{formula.CharacterCount}~"); // TCC line.Append($"{formula.AlphaNumericCharacterCount}~"); // TANCC line.Append($"{formula.AverageWordsPerSentence:0.00}~"); // TAWS line.Append($"{formula.AverageCharCountPerSentenceWord:0.00}~"); // TACCSW line.Append($"{formula.AverageCharCountPerWord:0.00}~"); // TACCW line.Append($"{formula.Sample.LetterCount}~"); // LC line.Append($"{formula.Sample.ComplexWords}~"); // CW line.Append($"{formula.Sample.AverageSyllablesPerWord:0.00}~"); // ASW line.Append($"{sentence.SyllableCount}~"); // SSyC line.Append($"{sentence.Words.Count}~"); // SWC line.Append($"{sentence.CharacterCount}~"); // SCC line.Append($"{sentence.AlphaNumericCharacterCount}~"); // SANCC line.Append($"\"{sentence.LineNumber}\"~"); // LN line.Append($"\"{sentence.Content}\"~"); // ST line.Append($"\"{word.Content}\"~"); // WT line.Append($"{word.SyllableCount}~"); // WSy line.Append($"{word.CharacterCount}~"); // WCC line.Append($"{word.AlphaNumericCharacterCount}~"); // WANCC writer.WriteLine(line.ToString()); line.Clear(); row += 1; }); }); }); writer.Flush(); writer.Close(); } Console.WriteLine(""); }
public void Write(List <TestResult> results) { _statusDisplay.SetText("Writing Top level sample results"); _statusDisplay.SetTotal(results.Count); using (var writer = new StreamWriter(_fileName)) { var row = 1; writer.WriteLine("#~F~T~V~S~TSC~TWC~TSyC~TCC~TANCC~TAWS~TACCS~TACCSW~LC~CW~ASW"); var line = new StringBuilder(); results.ForEach(result => { _statusDisplay.UpdateCount(row); line.Append($"{row++}~"); // # line.Append($"\"{result.FormulaName}\"~"); // F line.Append($"\"{result.Title}\"~"); // T line.Append($"\"{result.Sample.Variant}\"~"); // V line.Append($"{result.Score}~"); // S line.Append($"{result.Sentences.Count}~"); // TSC line.Append($"{result.WordCount}~"); // TWC line.Append($"{result.SyllableCount}~"); // TSyC line.Append($"{result.CharacterCount}~"); // TCC line.Append($"{result.AlphaNumericCharacterCount}~"); // TANCC line.Append($"{result.AverageWordsPerSentence}~"); // TAWS line.Append($"{result.AverageCharCountPerSentenceWord}~"); // TACCS line.Append($"{result.AverageCharCountPerWord}~"); // TACCSW line.Append($"{result.Sample.LetterCount}~"); // LC line.Append($"{result.Sample.ComplexWords}~"); // CW line.Append($"{result.Sample.AverageSyllablesPerWord:0.00}"); // ASW writer.WriteLine(line.ToString()); line.Clear(); }); writer.Flush(); writer.Close(); } }