From: <jen...@us...> - 2009-05-07 11:41:55
|
Revision: 1748 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1748&view=rev Author: jenslehmann Date: 2009-05-07 11:41:54 +0000 (Thu, 07 May 2009) Log Message: ----------- mapping evaluator working Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-07 10:11:58 UTC (rev 1747) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaPoint.java 2009-05-07 11:41:54 UTC (rev 1748) @@ -77,7 +77,13 @@ while(rs.hasNext()) { QuerySolution qs = rs.nextSolution(); geoLat = qs.getLiteral("lat").getDouble(); + if(((Double)geoLat).toString().contains("E")) { + geoLat = 0.0; + } geoLong = qs.getLiteral("long").getDouble(); + if(((Double)geoLong).toString().contains("E")) { + geoLong = 0.0; + } label = qs.getLiteral("label").getString(); if(qs.contains("type")) { classList.add(qs.get("type").toString()); Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-07 10:11:58 UTC (rev 1747) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/Evaluation.java 2009-05-07 11:41:54 UTC (rev 1748) @@ -40,6 +40,7 @@ public class Evaluation { private int tests; + private int discarded; private int noMatchCount; private int correctMatchCount; private int incorrectMatchCount; @@ -53,6 +54,7 @@ public Evaluation(Map<URI,URI> testMatches) throws IOException { tests = 0; + discarded = 0; noMatchCount = 0; correctMatchCount = 0; incorrectMatchCount = 0; @@ -75,6 +77,7 @@ dbpediaPoint = new DBpediaPoint(match.getKey()); } catch (Exception e) { logger.debug(e.getMessage()); + discarded++; continue; } URI matchedURI = DBpediaLinkedGeoData.findGeoDataMatch(dbpediaPoint); @@ -133,6 +136,10 @@ return tests; } + public int getDiscarded() { + return discarded; + } + public static void main(String args[]) throws IOException { Logger.getRootLogger().setLevel(Level.TRACE); @@ -154,6 +161,7 @@ } // perform evaluation and print results Evaluation eval = new Evaluation(matches); + System.out.println(eval.getTests() + " points tested (" + eval.getDiscarded() + " discarded)"); System.out.println("precision: " + eval.getPrecision()); System.out.println("recall: " + eval.getRecall()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |