public class MSD2
extends java.lang.Object
This class has a main(java.lang.String[])
function that provides command-line
functionality for experimenting with the MSD algorithm.
This software is Copyright (C) 2004, by William Soukoreff and Scott MacKenzie.
Modifier and Type | Class and Description |
---|---|
class |
MSD2.Alignment
The purpose of this sub-class is to hold the information for one
alignment.
|
static interface |
MSD2.MSDCollection
The parameters to the MSD algorithm are provided through this interface.
|
static class |
MSD2.TwoStringCollection
An MSDCollection where the presented and transcribed text strings are
simple Java Strings, and the MSD compares the individual characters
within the strings.
|
static class |
MSD2.WordCollection
An MSDCollection object where the presented and transcribed texts are
Vectors of Strings (viz.
|
Constructor and Description |
---|
MSD2(MSD2.MSDCollection c)
This constructor takes an instance of a
MSD2.MSDCollection
object, and calculates the Minimum String Distance. |
MSD2(java.lang.String PresentedText,
java.lang.String TranscribedText)
This constructor takes two strings (the presented and transcribed
strings) and constructs a MSD object, using the
MSD2.TwoStringCollection implementation of the
MSD2.MSDCollection interface. |
MSD2(java.lang.String PresentedText,
java.lang.String TranscribedText,
boolean TranspositionsAllowed)
This constructor takes two strings (the presented and transcribed
strings) and constructs a MSD object, using the
MSD2.TwoStringCollection implementation of the
MSD2.MSDCollection interface. |
MSD2(java.util.Vector<java.lang.String> PresentedData,
java.util.Vector<java.lang.String> TranscribedData)
This constructor takes two
Vector s of strings (the
presented and transcribed data) and constructs a MSD object, using the
MSD2.WordCollection implementation of the
MSD2.MSDCollection interface. |
MSD2(java.util.Vector<java.lang.String> PresentedData,
java.util.Vector<java.lang.String> TranscribedData,
boolean TranspositionsAllowed)
This constructor takes two
Vector s of strings (the
presented and transcribed data) and constructs a MSD object, using the
MSD2.WordCollection implementation of the
MSD2.MSDCollection interface. |
Modifier and Type | Method and Description |
---|---|
MSD2.Alignment |
getAlignment(int alignment)
Get one of the alignments.
|
java.util.Vector<MSD2.Alignment> |
getAlignmentVector()
This function returns a Vector containing the alignments
(containing
MSD2.Alignment objects). |
int |
getAlignmentVectorSize()
This function returns the number of alignments.
|
double |
getAverageAlignmentLength()
Return the average alignment length.
|
double |
getErrorRateNew() |
int |
getMSD()
This function returns the minimum string distance (MSD) from the
MSD matrix.
|
java.lang.String |
getPresentedItem(int index)
Returns an element from the presented text.
|
int |
getPresentedSize()
This function returns the size of the presented text.
|
java.lang.String |
getTranscribedItem(int index)
Returns a element from the transcribed text.
|
int |
getTranscribedSize()
This function returns the size of the transcribed text.
|
static void |
main(java.lang.String[] args) |
void |
printMSDMatrix()
This function prints the contents of the MSD matrix to standard out.
|
public MSD2(MSD2.MSDCollection c)
MSD2.MSDCollection
object, and calculates the Minimum String Distance.c
- is the source of data for the MSD algorithm
(a MSD2.MSDCollection
object)MSD2.MSDCollection
public MSD2(java.lang.String PresentedText, java.lang.String TranscribedText, boolean TranspositionsAllowed)
MSD2.TwoStringCollection
implementation of the
MSD2.MSDCollection
interface.PresentedText
- the presented text stringTranscribedText
- the transcribed text stringTraqnspositionsAllowed
- a flag the specifies whether the MSD
algorithm should allow transpositions (reversals of neighbouring
elements in the presented and transcribed text stringsMSD2.TwoStringCollection
,
MSD2.WordCollection
,
MSD2.MSDCollection
,
MSD2(java.util.Vector<java.lang.String>, java.util.Vector<java.lang.String>)
public MSD2(java.lang.String PresentedText, java.lang.String TranscribedText)
MSD2.TwoStringCollection
implementation of the
MSD2.MSDCollection
interface.PresentedText
- the presented text stringTranscribedText
- the transcribed text stringMSD2.TwoStringCollection
,
MSD2.WordCollection
,
MSD2.MSDCollection
,
MSD2(java.util.Vector<java.lang.String>, java.util.Vector<java.lang.String>)
public MSD2(java.util.Vector<java.lang.String> PresentedData, java.util.Vector<java.lang.String> TranscribedData, boolean TranspositionsAllowed)
Vector
s of strings (the
presented and transcribed data) and constructs a MSD object, using the
MSD2.WordCollection
implementation of the
MSD2.MSDCollection
interface.PresentedText
- the presented text stringTranscribedText
- the transcribed text stringTraqnspositionsAllowed
- a flag the specifies whether the MSD
algorithm should allow transpositions (reversals of neighbouring
elements in the presented and transcribed text stringsMSD2.WordCollection
,
MSD2.TwoStringCollection
,
MSD2.MSDCollection
,
MSD2(java.util.Vector<java.lang.String>, java.util.Vector<java.lang.String>)
public MSD2(java.util.Vector<java.lang.String> PresentedData, java.util.Vector<java.lang.String> TranscribedData)
Vector
s of strings (the
presented and transcribed data) and constructs a MSD object, using the
MSD2.WordCollection
implementation of the
MSD2.MSDCollection
interface.PresentedText
- the presented text stringTranscribedText
- the transcribed text stringMSD2.WordCollection
,
MSD2.TwoStringCollection
,
MSD2.MSDCollection
,
MSD2(java.util.Vector<java.lang.String>, java.util.Vector<java.lang.String>)
public int getPresentedSize()
public java.lang.String getPresentedItem(int index)
index
- indicates which element of the presented text is desiredpublic int getTranscribedSize()
public java.lang.String getTranscribedItem(int index)
index
- indicates which element of the transcribed text is desiredpublic int getMSD()
public java.util.Vector<MSD2.Alignment> getAlignmentVector()
MSD2.Alignment
objects).MSD2.Alignment
public int getAlignmentVectorSize()
getAlignment(int)
public MSD2.Alignment getAlignment(int alignment)
alignment
- indicates which alignment should be returned.#getAlignmentSize
,
MSD2.Alignment
public double getAverageAlignmentLength()
public void printMSDMatrix()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
public double getErrorRateNew()