/** * @param aCas * the <code>JCas</code> object * @return return whether it is an identical pair or not */ protected final boolean isIdenticalPair(JCas aCas) { FSIterator<TOP> iter = aCas.getJFSIndexRepository().getAllIndexedFS( Pair.type); if (iter.hasNext()) { Pair p = (Pair) iter.next(); String text = p.getText().getCoveredText(); String hypothesis = p.getHypothesis().getCoveredText(); if (text.trim().equals(hypothesis.trim())) { return true; } } // empty pair return false; }
private void prepareCacheContent(JCas aJCas, String input) throws LAPException { // generate views and set SOFA JCas textView = null; JCas hypoView = null; try { textView = aJCas.createView(LAP_ImplBase.TEXTVIEW); hypoView = aJCas.createView(LAP_ImplBase.HYPOTHESISVIEW); } catch (CASException e) { throw new LAPException("Unble to create new views", e); } textView.setDocumentLanguage(this.languageId); hypoView.setDocumentLanguage(this.languageId); textView.setDocumentText(input); hypoView.setDocumentText(input); // annotate Text (on TextView) Text t = new Text(textView); t.setBegin(0); t.setEnd(input.length()); t.addToIndexes(); // annotate Hypothesis (on HypothesisView) Hypothesis h = new Hypothesis(hypoView); h.setBegin(0); h.setEnd(input.length()); h.addToIndexes(); // okay. now call underlyingLAP to annotate underlyingLAP.addAnnotationOn(aJCas, LAP_ImplBase.TEXTVIEW); underlyingLAP.addAnnotationOn(aJCas, LAP_ImplBase.HYPOTHESISVIEW); // done. aJCas is updated to be used for cache. actualCall ++; }
/** * @param aCas * the <code>JCas</code> object * @return return whether it is an identical pair or not */ protected final boolean isIdenticalPair(JCas aCas) { FSIterator<TOP> iter = aCas.getJFSIndexRepository().getAllIndexedFS( Pair.type); if (iter.hasNext()) { Pair p = (Pair) iter.next(); String text = p.getText().getCoveredText(); String hypothesis = p.getHypothesis().getCoveredText(); if (text.trim().equals(hypothesis.trim())) { return true; } } // empty pair return false; }
Text t = new Text(textView); t.setBegin(0); t.setEnd(text.length()); t.addToIndexes();
"Text: " + pair.getText().getCoveredText() + "\n" + "Hypothesis: " + pair.getHypothesis().getCoveredText());
"Text: " + pair.getText().getCoveredText() + "\n" + "Hypothesis: " + pair.getHypothesis().getCoveredText());
String hypothesis = null; try { text = p.getText().getCoveredText();
TextHypothesisPair pair = new TextHypothesisPair(textAnno.getCoveredText(), hypothesisAnno.getCoveredText(), id, gold, null); return new PairData(pair, textTrees, hypothesisTree, mapTreesToSentences, coreferenceInformation);