/** * given the canonical constituent, returns back the constitunts connected to it. * * @param mention canonical mention * @return the connected constituents */ @Deprecated public List<Constituent> getCoreferentMentions(Constituent mention) { List<Constituent> myMentions = (List<Constituent>) this.where(Queries.sameSpanAsConstituent(mention)); if (myMentions.size() == 0) return Collections.singletonList(mention); // TODO: this would create problem in overlapping mentions Constituent myMention = myMentions.get(0); Constituent canonicalEntity = getCanonicalEntity(myMention); return Mappers.map(getFilteredOutgoingRelations(canonicalEntity), relationsToConstituents); }
/** * given the canonical constituent, returns back the constitunts connected to it. * * @param mention canonical mention * @return the connected constituents */ @Deprecated public List<Constituent> getCoreferentMentions(Constituent mention) { List<Constituent> myMentions = (List<Constituent>) this.where(Queries.sameSpanAsConstituent(mention)); if (myMentions.size() == 0) return Collections.singletonList(mention); // TODO: this would create problem in overlapping mentions Constituent myMention = myMentions.get(0); Constituent canonicalEntity = getCanonicalEntity(myMention); return Mappers.map(getFilteredOutgoingRelations(canonicalEntity), relationsToConstituents); }
private void buildIndexFromRealCoref () { CoreferenceView corefView = (CoreferenceView)globalTA.getTa().getView(ViewNames.COREF); for(Constituent source : corefView.getConstituents()) { Constituent target = corefView.getCanonicalEntity(source); // String mention = source.getSurfaceString(); int start = source.getStartCharOffset(); int end = source.getEndCharOffset(); // String coreMention = target.getSurfaceString(); int corefStart = target.getStartCharOffset(); int corefEnd = target.getEndCharOffset(); predCorefStartMap.put(start, new Pair<Integer, Integer>(corefStart, corefEnd)); predCorefEndMap.put(end, new Pair<Integer, Integer>(corefStart, corefEnd)); if (isDebug) { String checkCoreference = contentRemovingTags.substring(corefStart, corefEnd); String checkMention = contentRemovingTags.substring(start, end); System.out.println ("[Mention] " + checkMention + " [Coref org] " + checkCoreference); } } }
private void buildIndexFromRealCoref () { CoreferenceView corefView = (CoreferenceView)globalTA.getTa().getView(ViewNames.COREF); for(Constituent source : corefView.getConstituents()) { Constituent target = corefView.getCanonicalEntity(source); // String mention = source.getSurfaceString(); int start = source.getStartCharOffset(); int end = source.getEndCharOffset(); // String coreMention = target.getSurfaceString(); int corefStart = target.getStartCharOffset(); int corefEnd = target.getEndCharOffset(); predCorefStartMap.put(start, new Pair<Integer, Integer>(corefStart, corefEnd)); predCorefEndMap.put(end, new Pair<Integer, Integer>(corefStart, corefEnd)); if (isDebug) { String checkCoreference = contentRemovingTags.substring(corefStart, corefEnd); String checkMention = contentRemovingTags.substring(start, end); System.out.println ("[Mention] " + checkMention + " [Coref org] " + checkCoreference); } } }