com.github.dylon.liblevenshtein.levenshtein.factory.CandidateFactory 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.
The newest version!
// Generated by delombok at Sat Apr 30 14:43:05 PDT 2016
package com.github.dylon.liblevenshtein.levenshtein.factory;
import java.io.Serializable;
import com.github.dylon.liblevenshtein.levenshtein.Candidate;
/**
* Builds spelling candidates of the requested type, optionally including the
* distance of the candidate from the query term.
* @param Kind of spelling candidate built by this factory.
* @author Dylon Edwards
* @since 2.1.2
*/
public abstract class CandidateFactory implements ICandidateFactory, Serializable {
private static final long serialVersionUID = 1L;
/**
* Builds instances of {@link Candidate}, with the dictionary term and its
* Levenshtein distance from the query term.
* @author Dylon Edwards
* @since 2.1.2
*/
public static class WithDistance extends CandidateFactory {
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
public Candidate build(final String term, final int distance) {
return new Candidate(term, distance);
}
}
/**
* Does not include the Levenshtein distance, but returns the dictionary term
* alone.
* @author Dylon Edwards
* @since 2.1.2
*/
public static class WithoutDistance extends CandidateFactory {
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
public String build(final String term, final int distance) {
return term;
}
}
@java.lang.SuppressWarnings("all")
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code")
@javax.annotation.Generated("lombok")
public CandidateFactory() {
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy