Package nzilbb.encoding.comparator
Class Orthography2DISCComparator<E>
- java.lang.Object
-
- nzilbb.encoding.comparator.Orthography2DISCComparator<E>
-
- All Implemented Interfaces:
EditComparator<E>
public class Orthography2DISCComparator<E> extends Object implements EditComparator<E>
Comparator that maps an (English) orthography series to a DISC-encoded series.
-
-
Constructor Summary
Constructors Constructor Description Orthography2DISCComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EditStep<E>
compare(E from, E to)
Compares two sequence elements, and evaluates the distance between them.EditStep<E>
delete(E from)
The distance for deleting the given element.EditStep<E>
insert(E to)
The distance for inserting the given element.
-
-
-
Method Detail
-
compare
public EditStep<E> compare(E from, E to)
Compares two sequence elements, and evaluates the distance between them.- Specified by:
compare
in interfaceEditComparator<E>
- Parameters:
from
- The element from the source sequence, which may be null,to
- The element from the destination sequence, which may be null.- Returns:
- An edit step between the two elements.
EditStep.getFrom()
is set to from,EditStep.getTo()
is set to to,EditStep.getStepDistance()
is set to the computed edit distance between these two elements, andEditStep.getOperation()
is set to either EditStep.StepOperation.NONE or EditStep.StepOperation.CHANGE.
-
delete
public EditStep<E> delete(E from)
The distance for deleting the given element.- Specified by:
delete
in interfaceEditComparator<E>
- Parameters:
from
- The element that would be deleted, which may be null.- Returns:
- An edit step with
EditStep.getStepDistance()
set to the distance for deleting the given element.EditStep.getFrom()
is set to from, andEditStep.getOperation()
is set to EditStep.StepOperation.DELETE
-
insert
public EditStep<E> insert(E to)
The distance for inserting the given element.- Specified by:
insert
in interfaceEditComparator<E>
- Parameters:
to
- The element that would be inserted, which may be null.- Returns:
- An edit step with
EditStep.getStepDistance()
set to the distance for inserting the given element.EditStep.getTo()
is set to to, andEditStep.getOperation()
is set to EditStep.StepOperation.INSERT
-
-