hcrypto.analyzer
Class TextStatistics
java.lang.Object
|
+--hcrypto.analyzer.TextStatistics
- All Implemented Interfaces:
- Analyzer
- public class TextStatistics
- extends java.lang.Object
- implements Analyzer
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
KAPPA_R
public static final double KAPPA_R
KAPPA_P
public static final double KAPPA_P
englishFrequency
public static final double[] englishFrequency
digram_chars
public static final int digram_chars
digram_data
public static final int[][] digram_data
charCount
public int charCount
alphabeticsCount
public int alphabeticsCount
coincidenceIndex
public double coincidenceIndex
TextStatistics
public TextStatistics()
TextStatistics
public TextStatistics(java.lang.String text)
TextStatistics
public TextStatistics(java.lang.String text,
boolean stripString)
getEnglishFrequency
public static double getEnglishFrequency(char ch)
- Static Utility Methods Used by Analyzers
chiSquare
public static double chiSquare(int[] expected,
int[] observed)
- Static methods for Computing chi square statistic
getIndexOfMinimum
public static int getIndexOfMinimum(double[] a)
removeNonAlphabetics
public static java.lang.String removeNonAlphabetics(java.lang.String s,
Alphabet a)
- This method removes all characters not in the alphabet
from the string.
removeDuplicates
public static java.lang.String removeDuplicates(java.lang.String s)
setup
public void setup(java.lang.String text)
- Part of Analyzer interface
- Specified by:
setup
in interface Analyzer
run
public void run()
- Specified by:
run
in interface Analyzer
getReport
public java.lang.String getReport()
- Specified by:
getReport
in interface Analyzer
print
public void print()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
calcStatistics
public void calcStatistics()
getCoincidenceIndex
public double getCoincidenceIndex()
getFrequencyTable
public FrequencyTable getFrequencyTable()
getCharCount
public int getCharCount()
- returns the total number of characters in the text
getFrequency
public int getFrequency(char inChar)
- returns the frequency of its char parameter
getKHighestFreqChar
public java.lang.String getKHighestFreqChar(int k)
- returns the the kth highest frequency character
getFrequencyReport
public java.lang.String getFrequencyReport()
- returns a 2-D table of frequencies