/** * @generated * @param jcas * JCas to which this Feature Structure belongs */ public CoreferenceChain(JCas jcas) { super(jcas); readObject(); }
private int getRemainingChainLength(CoreferenceLink link) { int counter = 0; while((link = link.getNext()) != null){ counter++; } return counter; } }
/** * @generated * @param jcas * JCas to which this Feature Structure belongs */ public CoreferenceLink(JCas jcas) { super(jcas); readObject(); }
storeReferencesAndTargetsInMap(referencesMap, entity, aCorpusData, aTokens, aJCas); CoreferenceChain chain = new CoreferenceChain(aJCas); CoreferenceLink link = null; for (Integer address : referencesMap.keySet()) { if (chain.getFirst() == null) { chain.setFirst(referencesMap.get(address)); link = chain.getFirst(); chain.addToIndexes(); } else { link.setNext(referencesMap.get(address)); if (link.getReferenceRelation() == null) { link.setReferenceRelation( referencesMap.get(address).getReferenceRelation()); link = link.getNext(); link.addToIndexes();
CoreferenceChain chain = new CoreferenceChain(aJCas); CoreferenceLink link = new CoreferenceLink(aJCas, chainBegin, chainEnd - 1); link.setReferenceType("text"); link.addToIndexes(); chain.setFirst(link); link.setReferenceRelation("entails"); Token outToken = new Token(aJCas, tokenBeginPosition, tokenBeginPosition + 1); link.setReferenceRelation("do not entails"); Token outToken = new Token(aJCas, tokenBeginPosition, tokenBeginPosition + 1); CoreferenceLink nextLink = new CoreferenceLink(aJCas, chainBegin, chainEnd - 1); nextLink.setReferenceType("hypothesis"); nextLink.addToIndexes(); link.setNext(nextLink); chain.addToIndexes(); text.append("\n");
CoreferenceLink link = new CoreferenceLink(jcas, mention.getCharOffsetStart(), mention.getCharOffsetEnd()); link.addToIndexes(); CoreferenceChain chain = new CoreferenceChain(jcas); chain.addToIndexes(); chain.setFirst(link); last.setNext(link);
/** * @generated * @param jcas * JCas to which this Feature Structure belongs * @param begin * offset to the begin spot in the SofA * @param end * offset to the end spot in the SofA */ public CoreferenceLink(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
@Override public FeatureStructure createFS(int addr, CASImpl cas) { if (CoreferenceChain_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = CoreferenceChain_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new CoreferenceChain(addr, CoreferenceChain_Type.this); CoreferenceChain_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else { return new CoreferenceChain(addr, CoreferenceChain_Type.this); } } };
@Override public FeatureStructure createFS(int addr, CASImpl cas) { if (CoreferenceLink_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = CoreferenceLink_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new CoreferenceLink(addr, CoreferenceLink_Type.this); CoreferenceLink_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else { return new CoreferenceLink(addr, CoreferenceLink_Type.this); } } };
public static void assertCoreference(String[][] aExpected, Collection<CoreferenceChain> aActual) { List<CoreferenceChain> actual = new ArrayList<CoreferenceChain>(aActual); for (String[] i : aExpected) { System.out.printf("%-20s - Expected: %s%n", "Coreference", asCopyableString(asList(i))); } for (CoreferenceChain i : actual) { System.out.printf("%-20s - Actual : %s%n", "Coreference", asCopyableString(toText(i.links()))); } if (aExpected.length == aActual.size()) { for (int i = 0; i < actual.size(); i++) { assertEquals(asCopyableString(asList(aExpected[i]), true), asCopyableString(toText(actual.get(i).links()), true)); } } else { fail("Expected [" + aExpected.length + "] chains but found " + aActual.size() + "]"); } }
/** * initialize variables to correspond with Cas Type and Features * * @generated * @param jcas * JCas * @param casType * Type */ public CoreferenceChain_Type(JCas jcas, Type casType) { super(jcas, casType); casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator()); casFeat_first = jcas.getRequiredFeatureDE(casType, "first", "de.tudarmstadt.ukp.dkpro.core.api.coref.type.CoreferenceLink", featOkTst); casFeatCode_first = (null == casFeat_first) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl) casFeat_first).getCode(); } }
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
storeReferencesAndTargetsInMap(referencesMap, entity, aCorpusData, aTokens, aJCas); CoreferenceChain chain = new CoreferenceChain(aJCas); CoreferenceLink link = null; for (Integer address : referencesMap.keySet()) { if (chain.getFirst() == null) { chain.setFirst(referencesMap.get(address)); link = chain.getFirst(); chain.addToIndexes(); } else { link.setNext(referencesMap.get(address)); if (link.getReferenceRelation() == null) { link.setReferenceRelation( referencesMap.get(address).getReferenceRelation()); link = link.getNext(); link.addToIndexes();
CoreferenceChain chain = new CoreferenceChain(aJCas); CoreferenceLink link = new CoreferenceLink(aJCas, chainBegin, chainEnd - 1); link.setReferenceType("text"); link.addToIndexes(); chain.setFirst(link); link.setReferenceRelation("entails"); Token outToken = new Token(aJCas, tokenBeginPosition, tokenBeginPosition + 1); link.setReferenceRelation("do not entails"); Token outToken = new Token(aJCas, tokenBeginPosition, tokenBeginPosition + 1); CoreferenceLink nextLink = new CoreferenceLink(aJCas, chainBegin, chainEnd - 1); nextLink.setReferenceType("hypothesis"); nextLink.addToIndexes(); link.setNext(nextLink); chain.addToIndexes(); text.append("\n");
/** * Internal - constructor used by generator * * @generated * @param addr * low level Feature Structure reference * @param type * the type of this Feature Structure */ public CoreferenceChain(int addr, TOP_Type type) { super(addr, type); readObject(); }
/** * Internal - constructor used by generator * * @generated * @param addr * low level Feature Structure reference * @param type * the type of this Feature Structure */ public CoreferenceLink(int addr, TOP_Type type) { super(addr, type); readObject(); }
storeReferencesAndTargetsInMap(referencesMap, entity, aCorpusData, aTokens, aJCas); CoreferenceChain chain = new CoreferenceChain(aJCas); CoreferenceLink link = null; for (Integer address : referencesMap.keySet()) { if (chain.getFirst() == null) { chain.setFirst(referencesMap.get(address)); link = chain.getFirst(); chain.addToIndexes(); link.setNext(referencesMap.get(address)); if (link.getReferenceRelation() == null) { link.setReferenceRelation(referencesMap.get(address).getReferenceRelation()); link = link.getNext(); link.addToIndexes();
CoreferenceChain chain = new CoreferenceChain(aJCas); CoreferenceLink link = new CoreferenceLink(aJCas, chainBegin, chainEnd-1); link.setReferenceType("text"); link.addToIndexes(); chain.setFirst(link); link.setReferenceRelation("entails"); Token outToken = new Token(aJCas, tokenBeginPosition, tokenBeginPosition + 1); link.setReferenceRelation("do not entails"); Token outToken = new Token(aJCas, tokenBeginPosition, tokenBeginPosition + 1); CoreferenceLink nextLink = new CoreferenceLink(aJCas, chainBegin, chainEnd-1); nextLink.setReferenceType("hypothesis"); nextLink.addToIndexes(); link.setNext(nextLink); chain.addToIndexes(); text.append("\n");
storeReferencesAndTargetsInMap(referencesMap, entity, aCorpusData, aTokens, aJCas); CoreferenceChain chain = new CoreferenceChain(aJCas); CoreferenceLink link = null; for (Integer address : referencesMap.keySet()) { if (chain.getFirst() == null) { chain.setFirst(referencesMap.get(address)); link = chain.getFirst(); chain.addToIndexes(); link.setNext(referencesMap.get(address)); if (link.getReferenceRelation() == null) { link.setReferenceRelation( referencesMap.get(address).getReferenceRelation()); link = link.getNext(); link.addToIndexes();