public abstract class AbstractStringDistance extends Object implements StringDistance, StringDistanceLearner
| Constructor and Description |
|---|
AbstractStringDistance() |
| Modifier and Type | Method and Description |
|---|---|
void |
addExample(DistanceInstance answeredQuery)
Implements StringDistanceLearner api by accepting new
DistanceInstance labels.
|
protected static void |
doMain(StringDistance d,
String[] argv)
Default main routine for testing
|
String |
explainScore(String s,
String t)
Scores are explained by converting Strings to StringWrappers
with the prepare function.
|
abstract String |
explainScore(StringWrapper s,
StringWrapper t)
This method needs to be implemented by subclasses.
|
StringDistance |
getDistance()
Implements the StringDistanceLearner api by return a StringDistance.
|
boolean |
hasNextQuery()
Implements StringDistanceLearner api by informing a teacher
if the learner has DistanceInstance queries.
|
DistanceInstance |
nextQuery()
Implements StringDistanceLearner api by querying for
DistanceInstance labels.
|
DistanceInstanceIterator |
prepare(DistanceInstanceIterator i)
Implements StringDistanceLearner api by providing a way to prep a
DistanceInstanceIterator for training.
|
StringWrapper |
prepare(String s)
Default way to preprocess a string for distance computation.
|
StringWrapperIterator |
prepare(StringWrapperIterator i)
Implements StringDistanceLearner api by providing a way to prep a
StringWrapperIterator for training.
|
double |
score(String s,
String t)
Strings are scored by converting them to StringWrappers with the
prepare function.
|
abstract double |
score(StringWrapper s,
StringWrapper t)
This method needs to be implemented by subclasses.
|
void |
setDistanceInstancePool(DistanceInstanceIterator i)
Implements StringDistanceLearner api by providing a way to
accept a pool of unlabeled DistanceInstance's.
|
void |
setStringWrapperPool(StringWrapperIterator i)
Implements the StringDistanceLearner api, by providing a way to
accumulate statistics for a set of related strings.
|
public abstract double score(StringWrapper s, StringWrapper t)
score in interface StringDistancepublic abstract String explainScore(StringWrapper s, StringWrapper t)
explainScore in interface StringDistancepublic final double score(String s, String t)
score in interface StringDistancepublic final String explainScore(String s, String t)
explainScore in interface StringDistancepublic StringWrapper prepare(String s)
prepare in interface StringDistancepublic void setStringWrapperPool(StringWrapperIterator i)
setStringWrapperPool in interface StringDistanceLearnerpublic void setDistanceInstancePool(DistanceInstanceIterator i)
setDistanceInstancePool in interface StringDistanceLearnerpublic boolean hasNextQuery()
hasNextQuery in interface StringDistanceLearnerpublic DistanceInstance nextQuery()
nextQuery in interface StringDistanceLearnerpublic void addExample(DistanceInstance answeredQuery)
addExample in interface StringDistanceLearnerpublic StringWrapperIterator prepare(StringWrapperIterator i)
prepare in interface StringDistanceLearnerpublic DistanceInstanceIterator prepare(DistanceInstanceIterator i)
prepare in interface StringDistanceLearnerpublic StringDistance getDistance()
getDistance in interface StringDistanceLearnerprotected static final void doMain(StringDistance d, String[] argv)
Copyright © 2016. All rights reserved.