tml.vectorspace.operations
Class Readability

java.lang.Object
  extended by tml.vectorspace.operations.AbstractOperation<ReadabilityResult>
      extended by tml.vectorspace.operations.Readability
All Implemented Interfaces:
Operation<ReadabilityResult>

public class Readability
extends AbstractOperation<ReadabilityResult>

This operation a calculation of readability measurements

Author:
Luan Nguyen, Stephen O'Rourke

Constructor Summary
Readability()
           
 
Method Summary
 double calculateDifferent(double number1, double number2)
          Calculate the difference between readability indices of 2 paragraphs a absolute value is return because we are only interested in the difference not comparing between the two paragraphs
 double calculateGradeLevel(double numberOfWord, double numberOfSentence, double numberOfSyllable)
          Calculate Flesch Kincaid Grade Level from number of words, number of sentence and number of syllable given This uses the standard Flesch Kincaid Grade Level formula
 double calculateReadingEase(double numberOfWord, double numberOfSentence, double numberOfSyllable)
          Calculate Flesch Reading Ease from number of words, number of sentence and number of syllable given This uses the standard Flesch Reading Ease formula
 double countSyllable(java.lang.String input)
          Count number of syllable per word input using the rules provided
 void differentiate(java.util.ArrayList<ReadabilityResult> results)
          Calculate the difference between readability indices of 2 consecutive paragraphs
 boolean isVowel(char input)
          Check if the string (char input) is a vowel e.g a,e,i,o,u and y (y is treated as a vowel also)
 boolean isWord(java.lang.String word)
          Check if a string is a word
 void start()
          Start the operation (non-Javadoc)
 
Methods inherited from class tml.vectorspace.operations.AbstractOperation
addOperationListener, getBackgroundKnowledgeCorpus, getCorpus, getMaxResults, getName, getRepository, getResults, getResultsCSVString, getResultsNumber, getResultsString, getResultsStringTable, getResultsTable, getResultsTableHeader, getResultsXML, getTimeElapsed, printResults, printResultsCSV, printResultsMatlab, removeOperationListener, setBackgroundKnowledgeCorpus, setCorpus, setMaxResults, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Readability

public Readability()
Method Detail

isWord

public boolean isWord(java.lang.String word)
Check if a string is a word

Parameters:
word -
Returns:
if the word

isVowel

public boolean isVowel(char input)
Check if the string (char input) is a vowel e.g a,e,i,o,u and y (y is treated as a vowel also)

Parameters:
input - a character
Returns:
if the character is a vowel

countSyllable

public double countSyllable(java.lang.String input)
Count number of syllable per word input using the rules provided

Parameters:
input - text to count syllables from
Returns:
the number of syllables in the text

calculateGradeLevel

public double calculateGradeLevel(double numberOfWord,
                                  double numberOfSentence,
                                  double numberOfSyllable)
Calculate Flesch Kincaid Grade Level from number of words, number of sentence and number of syllable given This uses the standard Flesch Kincaid Grade Level formula

Parameters:
numberOfWord -
numberOfSentence -
numberOfSyllable -
Returns:
Flesch Kincaid grade level

calculateReadingEase

public double calculateReadingEase(double numberOfWord,
                                   double numberOfSentence,
                                   double numberOfSyllable)
Calculate Flesch Reading Ease from number of words, number of sentence and number of syllable given This uses the standard Flesch Reading Ease formula

Parameters:
numberOfWord -
numberOfSentence -
numberOfSyllable -
Returns:
the Flesch Reading Ease index

calculateDifferent

public double calculateDifferent(double number1,
                                 double number2)
Calculate the difference between readability indices of 2 paragraphs a absolute value is return because we are only interested in the difference not comparing between the two paragraphs

Parameters:
number1 -
number2 -
Returns:
difference between two paragraphs' indices

differentiate

public void differentiate(java.util.ArrayList<ReadabilityResult> results)
Calculate the difference between readability indices of 2 consecutive paragraphs

Parameters:
results -

start

public void start()
           throws java.lang.Exception
Start the operation (non-Javadoc)

Specified by:
start in interface Operation<ReadabilityResult>
Overrides:
start in class AbstractOperation<ReadabilityResult>
Throws:
java.lang.Exception
See Also:
AbstractOperation.start()