com.github.dylon.liblevenshtein.levenshtein.StandardPositionComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liblevenshtein Show documentation
Show all versions of liblevenshtein Show documentation
A library for spelling-correction based on Levenshtein Automata.
package com.github.dylon.liblevenshtein.levenshtein;
import java.io.Serializable;
import java.util.Comparator;
/**
* Sorts position vectors for the standard, Levenshtein algorithm.
* @author Dylon Edwards
* @since 2.1.0
*/
public class StandardPositionComparator implements Serializable, Comparator {
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
public int compare(final int[] a, final int[] b) {
int c = a[0] - b[0];
if (0 != c) return c;
return a[1] - b[1];
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy