/** * 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); }
/** * 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); }
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); }