Package nzilbb.editpath
Interface EditComparator<T>
-
- All Known Subinterfaces:
IEditComparator<T>
- All Known Implementing Classes:
ARPAbet2DISCComparator,Char2CharComparator,DefaultEditComparator,DISC2ARPAbetComparator,DISC2DISCComparator,DISC2IPAComparator,IPA2DISCComparator,IPA2IPAComparator,Orthography2ARPAbetComparator,Orthography2DISCComparator,Orthography2OrthographyComparator,XSAMPA2IPAComparator
public interface EditComparator<T>Interface for comparators between elements.This interface uses
EditStepboth for convenience, and also to allow the possibility of an edit operation having bothEditStep.getStepDistance()= 0 andEditStep.getOperation()is set to either EditStep.StepOperation.CHANGE. This allows for non-equal elements to have zero distance, but still preserve the fact of their inequality.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EditStep<T>compare(T from, T to)Compares two sequence elements, and evaluates the distance between them.EditStep<T>delete(T from)The distance for deleting the given element.EditStep<T>insert(T to)The distance for inserting the given element.
-
-
-
Method Detail
-
compare
EditStep<T> compare(T from, T to)
Compares two sequence elements, and evaluates the distance between them.- 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
EditStep<T> delete(T from)
The distance for deleting the given element.- 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
EditStep<T> insert(T to)
The distance for inserting the given element.- 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
-
-