|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthcrypto.analyzer.tool.TextStatistics
public class TextStatistics
Defines a SINGLETON object that is designed to compute and store various useful statistics for a give text. The text is represted as a String.
| Field Summary | |
|---|---|
int |
alphabeticsCount
|
int |
charCount
|
double |
coincidenceIndex
|
static int |
digram_chars
|
static int[][] |
digram_data
|
static double[] |
englishFrequency
|
static double |
KAPPA_P
|
static double |
KAPPA_R
|
| Fields inherited from interface hcrypto.analyzer.Analyzer |
|---|
DECIPHER_LIMIT |
| Constructor Summary | |
|---|---|
TextStatistics()
|
|
TextStatistics(java.lang.String text)
|
|
TextStatistics(java.lang.String text,
boolean stripString)
|
|
| Method Summary | |
|---|---|
void |
calcStatistics()
|
static double |
chiSquare(int[] expected,
int[] observed)
Static methods for Computing chi square statistic |
int |
getCharCount()
returns the total number of characters in the text |
double |
getCoincidenceIndex()
|
static double |
getEnglishFrequency(char ch)
Static Utility Methods Used by Analyzers |
int |
getFrequency(char inChar)
returns the frequency of its char parameter |
java.lang.String |
getFrequencyReport()
returns a 2-D table of frequencies |
FrequencyTable |
getFrequencyTable()
|
static int |
getIndexOfMinimum(double[] a)
|
java.lang.String |
getKHighestFreqChar(int k)
returns the the kth highest frequency character |
java.lang.String |
getReport()
|
void |
print()
|
static java.lang.String |
removeDuplicates(java.lang.String s)
|
static java.lang.String |
removeNonAlphabetics(java.lang.String s,
Alphabet a)
This method removes all characters not in the alphabet from the string. |
void |
run()
|
void |
setup(java.lang.String text)
Part of Analyzer interface |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final double KAPPA_R
public static final double KAPPA_P
public static final double[] englishFrequency
public static final int digram_chars
public static final int[][] digram_data
public int charCount
public int alphabeticsCount
public double coincidenceIndex
| Constructor Detail |
|---|
public TextStatistics()
public TextStatistics(java.lang.String text)
public TextStatistics(java.lang.String text,
boolean stripString)
| Method Detail |
|---|
public static double getEnglishFrequency(char ch)
public static double chiSquare(int[] expected,
int[] observed)
public static int getIndexOfMinimum(double[] a)
public static java.lang.String removeNonAlphabetics(java.lang.String s,
Alphabet a)
public static java.lang.String removeDuplicates(java.lang.String s)
public void setup(java.lang.String text)
setup in interface Analyzerpublic void run()
run in interface Analyzerpublic java.lang.String getReport()
getReport in interface Analyzerpublic void print()
public java.lang.String toString()
toString in class java.lang.Objectpublic void calcStatistics()
public double getCoincidenceIndex()
public FrequencyTable getFrequencyTable()
public int getCharCount()
public int getFrequency(char inChar)
public java.lang.String getKHighestFreqChar(int k)
public java.lang.String getFrequencyReport()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||