R
- the result class of this algorithm.N
- the enum containing the nonterminal symbols of the input grammar.public abstract class AbstractADPAlgorithm<R,N extends Enum<N>> extends Object implements AlignmentAlgorithm<R>
Constructor and Description |
---|
AbstractADPAlgorithm(Grammar<N> grammar,
Class<R> resultClass,
AlignmentSpecification alignmentSpecification) |
Modifier and Type | Method and Description |
---|---|
R |
calculateAlignment(Sequence a,
Sequence b)
This calculates the alignment between the Sequences a and b and returns
it as an instance of the result class for this algorithm.
|
abstract double |
choice(double[] choices)
This should implement the choice function as the term is used
in the Bellman's Gap context.
|
Grammar<N> |
getGrammar()
Returns the ADP grammar that is used as basis of this ADPAlgorithm.
|
Class<R> |
getResultClass()
This method shall return the class of the alignment result.
|
AlignmentSpecification |
getSpecification()
This should return the specification that is used for this Algorithm.
|
double |
getWeightThreshold() |
static double |
normalizeDissimilarity(double dissimilarity,
Sequence a,
Sequence b) |
void |
setWeightThreshold(double weightThreshold)
Set a weight threshold (between 0 and 1) that determines which keywords
should be ignored during calculation because their weight is negligible.
|
abstract R |
transformToResult(EnumMap<N,double[][]> dpTables,
double[][] compareMatrix,
double[] deletionMatrix,
double[] insertionMatrix,
double[] skipDeletionMatrix,
double[] skipInsertionMatrix,
Sequence a,
Sequence b)
This method should not be called from outside!
The subclass uses this method to transform the alignment matrix and the
input sequences to the actual alignment result.
|
public AbstractADPAlgorithm(Grammar<N> grammar, Class<R> resultClass, AlignmentSpecification alignmentSpecification)
public Grammar<N> getGrammar()
public Class<R> getResultClass()
getResultClass
in interface AlignmentAlgorithm<R>
public AlignmentSpecification getSpecification()
getSpecification
in interface AlignmentAlgorithm<R>
public void setWeightThreshold(double weightThreshold)
weightThreshold
- a weight threshold (between 0 and 1)public double getWeightThreshold()
public R calculateAlignment(Sequence a, Sequence b)
calculateAlignment
in interface AlignmentAlgorithm<R>
a
- The first sequence.b
- The second sequence.public static double normalizeDissimilarity(double dissimilarity, Sequence a, Sequence b)
public abstract double choice(double[] choices)
choices
- the costs of all choices.public abstract R transformToResult(EnumMap<N,double[][]> dpTables, double[][] compareMatrix, double[] deletionMatrix, double[] insertionMatrix, double[] skipDeletionMatrix, double[] skipInsertionMatrix, Sequence a, Sequence b)
dpTables
- the dynamic programming matrices used during
calculation.compareMatrix
- the local cost for replacing node i from the first
sequence with node j from the second sequence.deletionMatrix
- the local cost for deleting node i from the first
sequence.insertionMatrix
- the local cost for inserting node j from the
second sequence into the first sequence.skipDeletionMatrix
- the local cost for skipping node i in the
first sequence.skipInsertionMatrix
- the local cost for skipping node j in the
second sequence.a
- the first sequence.b
- th second sequence.Copyright (C) 2013-2015 Benjamin Paaßen, Georg Zentgraf, AG Theoretical Computer Science, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/tcs . This documentation is licensed under the conditions of CC-BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/