24 package org.lightjason.agentspeak.consistency.metric;
30 import java.util.stream.Collectors;
31 import java.util.stream.Stream;
69 public CLevenshteinDistance(
final double p_insertweight,
final double p_replaceweight,
final double p_deleteweight )
71 m_insertweight = p_insertweight;
72 m_replaceweight = p_replaceweight;
73 m_deleteweight = p_replaceweight;
78 public final Double
apply(
final Stream<? extends ITerm> p_first,
final Stream<? extends ITerm> p_second )
81 p_first.map( Object::toString ).collect( Collectors.joining(
"" ) ),
82 p_second.map( Object::toString ).collect( Collectors.joining(
"" ) ),
83 m_insertweight, m_replaceweight, m_deleteweight
metric based on levenshtein distance
final double m_replaceweight
cost / weight of replace operation
final double m_insertweight
cost / weight of insert operation
metric interface of the coherency structure
final Double apply(final Stream<? extends ITerm > p_first, final Stream<? extends ITerm > p_second)
CLevenshteinDistance(final double p_insertweight, final double p_replaceweight, final double p_deleteweight)
ctor
common structure for execution definition
CLevenshteinDistance()
ctor
final double m_deleteweight
cost / weight of delete operation
static double levenshtein( @Nonnull final String p_first, @Nonnull final String p_second, final double p_insertweight, final double p_replaceweight, final double p_deleteweight)
calculates the levenshtein distance