@Override public Marking getInstanceWith(final int offset, final int len, final List<String> uris) { return new NamedEntity(offset, len, new HashSet<>(uris)); } },
@Override public Marking getInstanceWith(final int offset, final int len, final List<String> uris) { return new TypedSpanImpl(offset, len, new HashSet<>(uris)); } };
classUri.add(ranker.rank(((TypedSpanImpl) marking).getTypes())); } else if (marking instanceof TypedNamedEntity) { for (String uri : typednamed.getUris()) { if (uri.contains("dbpedia.org/resource")) { namedUri.add(uri); uris.addAll(typednamed.getUris()); uris.addAll(typednamed.getTypes()); String ranked = ranker.rank(uris); if (ranker.disambiguateOntologyIsProperty(ranked)) { classUri.add(typednamed.getTypes().iterator().next()); String uri = named.getUris().iterator().next(); if (uri.contains("dbpedia.org/resource")) { namedUri.add(uri);
/** * Creates a NIF with annotations respective to given {@link NifProperty} * respective to given {@link ASpotter} Annotation will have the form * {@link NifProperty#TAIDENTREF} * * @param q The sentence to run IdexDBO o * @param spotter A spotter to find named entities * @return Created NIF */ public String createNIFResultFromSpotters(final String q, final ASpotter spotter) { Document doc = new DocumentImpl(q); addAllMarkingsToDoc(doc, stringToMarkingsSpotters(q, spotter)); return writeNIF(doc); }
Collections.sort(mentions, new StartPosBasedComparator());
annotations.add(new NamedEntity(namedEntity.getStartPos(), namedEntity.getLength(), URLDecoder .decode("http://aksw.org/notInWiki/" + namedEntity.getSingleWordLabel(), "UTF-8"))); } else { annotations.add(new NamedEntity(namedEntity.getStartPos(), namedEntity.getLength(), URLDecoder.decode(disambiguatedURL, "UTF-8")));
/** * Creates a NIF with annotations respective to given {@link NifProperty} * respective to given {@link IndexDBO} * * @param q The sentence to run IdexDBO on * @param indexDBO Choose implementation of @link {@link IndexDBO} to find * properties(classes) to store in nif * @param nif The kind of Annotation how found properties(classes) sould be * represented in NIF (e.g. taIdentRef,taClassRef) * @return Created NIF */ public String createNIFResultFromIndexDBO(final String q, final IndexDBO indexDBO, final NifProperty nif) { Document doc = new DocumentImpl(q); addAllMarkingsToDoc(doc, stringToMarkingsIndexDBO(q, indexDBO, nif)); return writeNIF(doc); }
annotations.add(new NamedEntity(namedEntity.getStartPos(), namedEntity.getLength(), URLDecoder .decode("http://aksw.org/notInWiki/" + namedEntity.getSingleWordLabel(), "UTF-8"))); } else { annotations.add(new NamedEntity(namedEntity.getStartPos(), namedEntity.getLength(), URLDecoder.decode(namedEntity.getNamedEntityUri(), "UTF-8")));
public String process(final String input) { List<Document> docs; try { docs = nif.parseNIF(input); } catch (Exception e) { return NifEverything.INPUT_NOT_PARSABLE; } List<Document> answerDocs = new ArrayList<>(); for (Document doc : docs) { Document answerDoc = new DocumentImpl(doc.getText()); List<Marking> resultMarkings = requestForStringAgdistis(createAgdistisString(doc)); nif.addAllMarkingsToDoc(answerDoc, resultMarkings); answerDocs.add(answerDoc); } return nif.writeNIF(answerDocs); }