Similitud de cadenas Simetria Cadenas Distancia Cadenas
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.moov.solution.util;
import org.apache.commons.lang.StringUtils;
import uk.ac.shef.wit.simmetrics.similaritymetrics.AbstractStringMetric;
import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein;
/**
*
* @author omar
*/
public class ComparaCadenas {
public static boolean run(String cadena1, String cadena2, float valorMinimoAceptado){
AbstractStringMetric metricMongeElkan = new Levenshtein();
float result = metricMongeElkan.getSimilarity(StringUtils.defaultString(cadena1,""), StringUtils.defaultString(cadena2,""));
//System.out.println("STR_1 = " + cadena1 + "\nSTR_2 = " + cadena2 + "\n RESP = " + result);
return result >= valorMinimoAceptado;
}
public static float run(String cadena1, String cadena2){
AbstractStringMetric metricMongeElkan = new Levenshtein();
float result = metricMongeElkan.getSimilarity(StringUtils.defaultString(cadena1,""), StringUtils.defaultString(cadena2,""));
//System.out.println("STR_1 = " + cadena1 + "\nSTR_2 = " + cadena2 + "\n RESP = " + result);
return result;
}
}
Package org.apache.commons.text.similarity