|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthcrypto.analyzer.evolutionary.NgramArray
public class NgramArray
| Field Summary |
|---|
| Fields inherited from interface hcrypto.analyzer.Analyzer |
|---|
DECIPHER_LIMIT |
| Constructor Summary | |
|---|---|
NgramArray(int N,
java.lang.String fileName,
Alphabet alph)
NgramArray(N, filename, alph) - constructor NN = N is the size of the N-gram N=2, 3, or 4 filename is a file containing a large text typical of the language of the cryptotext alphabet = alph describes which letters occur in the N-grams freq = the distribution of letters in text. |
|
NgramArray(int N,
java.lang.String fileName,
Alphabet alph,
int step)
NgramArray(N, filename, alph) - constructor NN = N is the size of the N-gram N=2, 3, or 4 |
|
| Method Summary | |
|---|---|
double |
absDiffBigramDist(java.lang.String ctext)
absDiffBigramDist(ctext) Computes a distance between this NgramArray and the distribution of bigrams in the string ctext. |
double |
freqDist(int[] cnums)
Computes a distance between this NgramArray and the distribution of N-grams of a crypto text as represented by an array of int values. |
double |
freqDist(java.lang.String ctext)
Computes a distance between this NgramArray and the distribution of N-grams in the string ctext. |
Alphabet |
getAlphabet()
|
int |
getAlphSize()
|
int |
getArrSize()
|
double |
getFreq(char ch)
|
java.lang.String |
getMostFreqWord(int k)
|
double |
getNgramFreq(java.lang.String ngram)
|
double |
getNGramProb(java.lang.String ngram)
getNgramProb() computes the probability of an ngram. |
int |
getNN()
|
java.lang.String |
getReport()
From the Analyzer interface. |
int |
getStepSize()
|
static void |
main(java.lang.String[] args)
|
void |
print()
|
double |
recipDist(int[] cnums)
Computes a distance between this NgramArray and the distribution of N-grams of a crypto text as represented by an array of int values. |
double |
recipDist(java.lang.String ctext)
Computes a distance between this NgramArray and the distribution of N-grams in the string ctext. |
double |
recipDist(java.lang.String ctext,
double[] scores)
Same as previous method except this one returns a double array that remembers the scores at each index of the cryptogram. |
double |
recipDist(java.lang.String ctext,
int[] indx)
Same as previous method except this one returns an array that remembers the indices of the smallest and greatest nGram scores in the cryptogram. |
double |
recipDistSkip(java.lang.String ctext)
Same as previous method except this one skips stepsize characters. |
void |
run()
From the Analyzer interface. |
void |
setStepSize(int newStep)
|
void |
setup(java.lang.String fileName)
From the Analyzer interface. |
double |
sqrDiffBigramDist(java.lang.String ctext)
sqrDiffBigramDist(ctext) Computes a distance between this NgramArray and the distribution of bigrams in the string ctext. |
double |
sqrDist(int[] cnums)
Computes a distance between this NgramArray and the distribution of N-grams of a crypto text as represented by an array of int values. |
double |
sqrDist(java.lang.String ctext)
Computes a distance between this NgramArray and the distribution of N-grams in the string ctext. |
java.lang.String |
toString()
Puts characters with frequencies into a string. |
void |
writeFreqWordsToFile(java.lang.String fileName)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NgramArray(int N,
java.lang.String fileName,
Alphabet alph)
throws java.lang.Exception
java.lang.Exception
public NgramArray(int N,
java.lang.String fileName,
Alphabet alph,
int step)
throws java.lang.Exception
filename - is a file containing a large text typical of the language
of the cryptotextalphabet - = alph describes which letters occur in the N-gramsstep - gives the step size >=1
freq = the distribution of letters in text.
java.lang.Exception| Method Detail |
|---|
public void setup(java.lang.String fileName)
setup in interface Analyzerpublic java.lang.String getReport()
getReport in interface Analyzerpublic void run()
run in interface Analyzerpublic java.lang.String toString()
toString in class java.lang.Objectpublic void print()
public int getAlphSize()
public Alphabet getAlphabet()
public int getNN()
public double getNGramProb(java.lang.String ngram)
throws java.lang.Exception
java.lang.Exception
public double getFreq(char ch)
throws java.lang.Exception
java.lang.Exception
public double getNgramFreq(java.lang.String ngram)
throws java.lang.Exception
java.lang.Exceptionpublic int getArrSize()
public void setStepSize(int newStep)
public int getStepSize()
public java.lang.String getMostFreqWord(int k)
public void writeFreqWordsToFile(java.lang.String fileName)
public double absDiffBigramDist(java.lang.String ctext)
throws java.lang.Exception
java.lang.Exception
public double sqrDiffBigramDist(java.lang.String ctext)
throws java.lang.Exception
java.lang.Exception
public double recipDist(java.lang.String ctext)
throws java.lang.Exception
java.lang.Exception
public double recipDistSkip(java.lang.String ctext)
throws java.lang.Exception
java.lang.Exception
public double recipDist(java.lang.String ctext,
int[] indx)
throws java.lang.Exception
java.lang.Exception
public double recipDist(java.lang.String ctext,
double[] scores)
throws java.lang.Exception
java.lang.Exception
public double recipDist(int[] cnums)
throws java.lang.Exception
java.lang.Exception
public double freqDist(java.lang.String ctext)
throws java.lang.Exception
java.lang.Exception
public double freqDist(int[] cnums)
throws java.lang.Exception
java.lang.Exception
public double sqrDist(java.lang.String ctext)
throws java.lang.Exception
java.lang.Exception
public double sqrDist(int[] cnums)
throws java.lang.Exception
java.lang.Exceptionpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||