TextStatistics Class
Provides numerous statistics such as line, word, character counts, and readability scores for text.
public class TextStatistics : ITextStatistics
- Inheritance:
- System.Object Object
- Implements:
- ITextStatistics
Constructors
TextStatistics(String)
Initializes a new instance of the TextStatistics class.
public TextStatistics(string text)
| Parameter | Type | Description |
|---|---|---|
| text | System.String | The text to examine and create statistics data. |
Properties
AverageLettersPerWord
Gets the average number of letters per word.
public double AverageLettersPerWord { get; }
Property Value
- System.Double:
The average number of letters per word.
AverageSyllablesPerWord
Gets the average number of syllables per word.
public double AverageSyllablesPerWord { get; }
Property Value
- System.Double:
The average number of syllables per word.
AverageWordsPerSentence
Gets the average number of words per sentence.
public double AverageWordsPerSentence { get; }
Property Value
- System.Double:
The average number of words per sentence.
Characters
Gets the number of characters in the text.
public int Characters { get; }
Property Value
- System.Int32:
The number of characters in the text.
Consonants
Gets the number of consonants in the text.
public int Consonants { get; }
Property Value
- System.Int32:
The number of consonants in the text.
FleschKincaidGradeLevel
Gets the Flesch-Kincaid grade level, which indicates the number of years of education required to understand the text.
public double FleschKincaidGradeLevel { get; }
Property Value
- System.Double
Remarks
A grade level of 7.1 indicates that an individual with about 7 years of education could understand the text.
FleschReadingEaseScore
Gets the Flesch reading ease score in the range of 0 to 100, which indicates how readable the text is.
public double FleschReadingEaseScore { get; }
Property Value
- System.Double
Remarks
Scores of 90-100 are considered easily understandable by an average 5th grader. Scores of 60-70 are considered easily understandable by 8th and 9th grade students. Scores of 0-30 are best understood by college graduates.
Letters
Gets the number of letters in the text.
public int Letters { get; }
Property Value
- System.Int32:
The number of letters in the text.
Lines
Gets the number of lines in the text.
public int Lines { get; }
Property Value
- System.Int32:
The number of lines in the text.
NonWhitespaceCharacters
Gets the number of non-whitespace characters in the text.
public int NonWhitespaceCharacters { get; }
Property Value
- System.Int32:
The number of non-whitespace characters in the text.
NonWhitespaceLines
Gets the number of non-whitespace lines in the text.
public int NonWhitespaceLines { get; }
Property Value
- System.Int32:
The number of non-whitespace lines in the text.
Sentences
Gets the number of sentences in the text.
public int Sentences { get; }
Property Value
- System.Int32:
The number of sentences in the text.
Syllables
Gets the number of syllables in the text.
public int Syllables { get; }
Property Value
- System.Int32:
The number of syllables in the text.
Vowels
Gets the number of vowels in the text.
public int Vowels { get; }
Property Value
- System.Int32:
The number of vowels in the text.
WhitespaceCharacters
Gets the number of whitespace characters in the text.
public int WhitespaceCharacters { get; }
Property Value
- System.Int32:
The number of whitespace characters in the text.
WhitespaceLines
Gets the number of whitespace lines in the text.
public int WhitespaceLines { get; }
Property Value
- System.Int32:
The number of whitespace lines in the text.
Words
Gets the number of words in the text.
public int Words { get; }
Property Value
- System.Int32:
The number of words in the text.
Methods
CreateStatistic(String, String, Object)
Creates an ITextStatistic with the specified key and value.
public static ITextStatistic CreateStatistic(string key, string description, object value)
| Parameter | Type | Description |
|---|---|---|
| key | System.String | The key of the statistic. |
| description | System.String | The description of the statistic, generally displayed in the user interface. |
| value | System.Object | The value of the statistic. |
Returns
- ITextStatistic:
The ITextStatistic that was created.
GetRawStatistics()
Returns the list of ITextStatistic objects that contain the statistic results.
public virtual IList<ITextStatistic> GetRawStatistics()
Returns
- System.Collections.Generic.IList<ITextStatistic>:
The list of ITextStatistic objects that contain the statistic results.
Inherited Members
- System.Object.ToString()
- System.Object.Equals(System.Object)
- System.Object.Equals(System.Object, System.Object)
- System.Object.ReferenceEquals(System.Object, System.Object)
- System.Object.GetHashCode()
- System.Object.GetType()
- System.Object.MemberwiseClone()