From: <lor...@us...> - 2013-09-03 15:16:27
|
Revision: 4033 http://sourceforge.net/p/dl-learner/code/4033 Author: lorenz_b Date: 2013-09-03 15:16:21 +0000 (Tue, 03 Sep 2013) Log Message: ----------- Added annotation. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/AnnotatedDocument.java trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/AnnotatedTextDocument.java trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/Annotation.java trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/SemanticAnnotator.java trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/semantic/simple/SimpleSemanticIndex.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/AnnotatedDocument.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/AnnotatedDocument.java 2013-09-03 14:43:56 UTC (rev 4032) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/AnnotatedDocument.java 2013-09-03 15:16:21 UTC (rev 4033) @@ -23,7 +23,7 @@ * Returns all annotations of the document. * @return */ - Set<Annotation> getAnnotations(); + Set<SemanticAnnotation> getAnnotations(); /** * Returns the annotation at the given position(offset) of given length. @@ -31,7 +31,7 @@ * @param length * @return */ - Annotation getAnnotation(int offset, int length); + SemanticAnnotation getAnnotation(int offset, int length); /** * Returns the number of occurrences of the given entity in this document. Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/AnnotatedTextDocument.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/AnnotatedTextDocument.java 2013-09-03 14:43:56 UTC (rev 4032) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/AnnotatedTextDocument.java 2013-09-03 15:16:21 UTC (rev 4033) @@ -15,16 +15,16 @@ public class AnnotatedTextDocument implements AnnotatedDocument{ private TextDocument document; - private Set<Annotation> annotations; + private Set<SemanticAnnotation> annotations; private Set<Entity> entities; - public AnnotatedTextDocument(TextDocument document, Set<Annotation> annotations) { + public AnnotatedTextDocument(TextDocument document, Set<SemanticAnnotation> annotations) { this.document = document; this.annotations = annotations; entities = new HashSet<Entity>(); - for (Annotation annotation : annotations) { + for (SemanticAnnotation annotation : annotations) { entities.add(annotation.getEntity()); } } @@ -57,7 +57,7 @@ * @see org.dllearner.algorithms.isle.index.AnnotatedDocument#getAnnotations() */ @Override - public Set<Annotation> getAnnotations() { + public Set<SemanticAnnotation> getAnnotations() { return annotations; } @@ -65,8 +65,8 @@ * @see org.dllearner.algorithms.isle.index.AnnotatedDocument#getAnnotation(int, int) */ @Override - public Annotation getAnnotation(int offset, int length) { - for (Annotation annotation : annotations) { + public SemanticAnnotation getAnnotation(int offset, int length) { + for (SemanticAnnotation annotation : annotations) { if(annotation.getOffset() == offset && annotation.getLength() == length){ return annotation; } @@ -80,7 +80,7 @@ @Override public int getEntityFrequency(Entity entity) { int cnt = 0; - for (Annotation annotation : annotations) { + for (SemanticAnnotation annotation : annotations) { if(annotation.getEntity().equals(entity)){ cnt++; } Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/Annotation.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/Annotation.java 2013-09-03 14:43:56 UTC (rev 4032) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/Annotation.java 2013-09-03 15:16:21 UTC (rev 4033) @@ -3,7 +3,6 @@ */ package org.dllearner.algorithms.isle.index; -import org.dllearner.core.owl.Entity; /** * @author Lorenz Buehmann @@ -12,13 +11,11 @@ public class Annotation { private Document getReferencedDocument; - private Entity entity; private int offset; private int length; - public Annotation(Document getReferencedDocument, Entity entity, int offset, int length) { + public Annotation(Document getReferencedDocument, int offset, int length) { this.getReferencedDocument = getReferencedDocument; - this.entity = entity; this.offset = offset; this.length = length; } @@ -27,10 +24,6 @@ return getReferencedDocument; } - public Entity getEntity() { - return entity; - } - public int getOffset() { return offset; } @@ -43,7 +36,6 @@ public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((entity == null) ? 0 : entity.hashCode()); result = prime * result + ((getReferencedDocument == null) ? 0 : getReferencedDocument.hashCode()); result = prime * result + length; result = prime * result + offset; @@ -59,11 +51,6 @@ if (getClass() != obj.getClass()) return false; Annotation other = (Annotation) obj; - if (entity == null) { - if (other.entity != null) - return false; - } else if (!entity.equals(other.entity)) - return false; if (getReferencedDocument == null) { if (other.getReferencedDocument != null) return false; Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/SemanticAnnotator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/SemanticAnnotator.java 2013-09-03 14:43:56 UTC (rev 4032) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/SemanticAnnotator.java 2013-09-03 15:16:21 UTC (rev 4033) @@ -7,7 +7,8 @@ * * @author Daniel Fleischhacker */ -public abstract class SemanticAnnotator { +public class SemanticAnnotator { + OWLOntology ontology; /** @@ -25,5 +26,7 @@ * @param document the document to annotate * @return the given document extended with annotations */ - public abstract AnnotatedDocument processDocument(Document document); + public AnnotatedDocument processDocument(Document document){ + return null; + } } Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/semantic/simple/SimpleSemanticIndex.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/semantic/simple/SimpleSemanticIndex.java 2013-09-03 14:43:56 UTC (rev 4032) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/semantic/simple/SimpleSemanticIndex.java 2013-09-03 15:16:21 UTC (rev 4033) @@ -43,7 +43,7 @@ */ @Override public Set<AnnotatedDocument> getDocuments(Entity entity) { - Set<Document> documents = new HashSet<Document>(); + Set<AnnotatedDocument> documents = new HashSet<AnnotatedDocument>(); Map<String, Double> relevantText = labelRetriever.getRelevantText(entity); for (Entry<String, Double> entry : relevantText.entrySet()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |