From: <seb...@us...> - 2012-04-24 07:47:46
|
Revision: 3657 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3657&view=rev Author: sebastianwtr Date: 2012-04-24 07:47:35 +0000 (Tue, 24 Apr 2012) Log Message: ----------- [tbsl-exploration] updated Levensthein-Module Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/modules/LevenstheinModule.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/modules/LevenstheinModule.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/modules/LevenstheinModule.java 2012-04-24 00:48:26 UTC (rev 3656) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/modules/LevenstheinModule.java 2012-04-24 07:47:35 UTC (rev 3657) @@ -9,7 +9,7 @@ import org.dllearner.algorithm.tbsl.exploration.Utils.Levenshtein; public class LevenstheinModule { - private final static double LevenstheinMin=0.85; + private final static double LevenstheinMin=0.65; public static ArrayList<Hypothesis> doLevensthein(String variable, String property_to_compare_with, HashMap<String, String> properties) throws SQLException { @@ -24,33 +24,44 @@ key=key.toLowerCase(); String value = entry.getValue(); - //compare property gotten from the resource with the property from the original query - double nld=Levenshtein.nld(property_to_compare_with.toLowerCase(), key); - - //if(nld>=LevenstheinMin||key.contains(lemmatiser.stem(property_to_compare_with))||property_to_compare_with.contains(lemmatiser.stem(key))){ - - if(key.contains(property_to_compare_with)||property_to_compare_with.contains(key)){ - if(nld<0.8){ - Hypothesis h = new Hypothesis(variable, key, value, "PROPERTY", 0.85); - listOfNewHypothesen.add(h); + ArrayList<String> property_array=new ArrayList<String>(); + property_array.add(property_to_compare_with); + if(property_to_compare_with.contains(" ")){ + + String[] array_temp = property_to_compare_with.split(" "); + for(String s : array_temp) property_array.add(s); + } + for(String compare_property :property_array ){ + + double nld=Levenshtein.nld(compare_property.toLowerCase(), key); + + //if(nld>=LevenstheinMin||key.contains(lemmatiser.stem(property_to_compare_with))||property_to_compare_with.contains(lemmatiser.stem(key))){ + + if(key.contains(compare_property)||compare_property.contains(key)){ + if(nld<0.8){ + Hypothesis h = new Hypothesis(variable, key, value, "PROPERTY", 0.85); + listOfNewHypothesen.add(h); + } + else{ + Hypothesis h = new Hypothesis(variable, key, value, "PROPERTY", nld); + listOfNewHypothesen.add(h); + } + } - else{ + else if(key.substring(key.length()-1).contains("s")){ + String neuer_string = key.substring(0, key.length() -1); + if(neuer_string.contains(compare_property)||compare_property.contains(neuer_string)){ + Hypothesis h = new Hypothesis(variable, neuer_string, value, "PROPERTY", 1.5); + listOfNewHypothesen.add(h); + } + } + else if(nld>=LevenstheinMin){ Hypothesis h = new Hypothesis(variable, key, value, "PROPERTY", nld); listOfNewHypothesen.add(h); } - } - else if(key.substring(key.length()-1).contains("s")){ - String neuer_string = key.substring(0, key.length() -1); - if(neuer_string.contains(property_to_compare_with)||property_to_compare_with.contains(neuer_string)){ - Hypothesis h = new Hypothesis(variable, neuer_string, value, "PROPERTY", 1.5); - listOfNewHypothesen.add(h); - } - } - else if(nld>=LevenstheinMin){ - Hypothesis h = new Hypothesis(variable, key, value, "PROPERTY", nld); - listOfNewHypothesen.add(h); - } + //compare property gotten from the resource with the property from the original query + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |