ShareReadability
Sentence.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
2 using System.Drawing;
3 
4 namespace ShareReadability.Container
5 {
6  /// @file Sentence.cs
7  /// <summary>
8  /// This class represents a container for a sentence.
9  /// </summary>
10  public class Sentence
11  {
12  // The raw text
13  public string Text { get; set; }
14 
15  // The plaintext without LaTeX commands
16  public string PlainText { get; set; }
17 
18  // The highlight color
19  public Color Color { get; set; }
20 
21  // The verbs and nouns of this sentence
22  public List<string> Verbs { get; set; }
23  public List<string> Nouns { get; set; }
24 
25  // Average of the features
26  public float AverageForSentence { get; set; }
27 
28  // Features
29  public float AverageWordLength { get; set; }
30  public float SentenceLength { get; set; }
31  public float VocabularyComplexity { get; set; }
32  public float NounToVerbRatio { get; set; }
33  public float SentenceStructureComplexity { get; set; }
34 
35 
36 
37  /// <summary>
38  /// Generates a string representation of the sentence.
39  /// </summary>
40  /// <returns>A string representation of the sentence.</returns>
41  public override string ToString()
42  {
43  var s = "";
44  s += "Average for Sentence: " + AverageForSentence + "\n\n";
45 
46  s += "Average Word Length: " + AverageWordLength + "\n";
47  s += "Vocabulary Complexity: " + VocabularyComplexity + "\n";
48  s += "Noun to Verb Ratio: " + NounToVerbRatio + "\n";
49  s += "Sentence Length: " + SentenceLength + "\n";
50  s += "Sentence Structure Complexity: " + SentenceStructureComplexity;
51 
52  return s;
53  }
54 
55  /// <summary>
56  /// Generates a string representation of the sentence to display it as comment.
57  /// </summary>
58  /// <returns>A string representation to use as a comment.</returns>
59  public string GenerateComment()
60  {
61  var s = "";
62  s += string.Format("Average for Sentence: {0:0.00}\\textCR\\textCR ", AverageForSentence);
63 
64 
65  s += string.Format("Average Word Length: {0:0.00}\\textCR ", AverageWordLength);
66  s += string.Format("Vocabulary Complexity: {0:0.00}\\textCR ", VocabularyComplexity);
67  s += string.Format("Noun to Verb Ratio: {0:0.00}\\textCR ", NounToVerbRatio);
68  s += string.Format("Sentence Length: {0:0.00}\\textCR ", SentenceLength);
69  s += string.Format("Sentence Structure Complexity: {0:0.00}", SentenceStructureComplexity);
70 
71  return s;
72  }
73  }
74 }
string GenerateComment()
Generates a string representation of the sentence to display it as comment.
Definition: Sentence.cs:59
override string ToString()
Generates a string representation of the sentence.
Definition: Sentence.cs:41