private static void addPassiveAgentToReln(SemanticGraph sg, IndexedWord gov, IndexedWord mod, IndexedWord caseMarker) { SemanticGraphEdge edge = sg.getEdge(gov, mod); GrammaticalRelation reln = UniversalEnglishGrammaticalRelations.AGENT; edge.setRelation(reln); }
private static void addCaseMarkersToReln(SemanticGraph sg, IndexedWord gov, IndexedWord mod, IndexedWord caseMarker) { SemanticGraphEdge edge = sg.getEdge(gov, mod); List<IndexedWord> caseMarkers = new ArrayList<>(); caseMarkers.add(caseMarker); sg.getChildrenWithReln(caseMarker, FIXED).stream().forEach(iw -> caseMarkers.add(iw)); Collections.sort(caseMarkers); String relnName = StringUtils.join(caseMarkers.stream().map(iw->iw.lemma()), "_"); if (relnName.matches("[^a-zA-Z_]")) { return; } //for Joakim //GrammaticalRelation reln = getCaseMarkedRelation(edge.getRelation(), relnName.toLowerCase() + ":ENH_CASE"); GrammaticalRelation reln = getCaseMarkedRelation(edge.getRelation(), relnName.toLowerCase()); edge.setRelation(reln); }
private static void addConjToReln(SemanticGraph sg, IndexedWord gov, List<IndexedWord> conjDeps, IndexedWord ccDep) { for (IndexedWord conjDep : conjDeps) { SemanticGraphEdge edge = sg.getEdge(gov, conjDep); if (edge.getRelation().toString().equals("conj") || conjDep.index() > ccDep.index()) { //for Joakim //edge.setRelation(UniversalGrammaticalRelations.getConj(conjValue(ccDep, sg) + ":ENH_CONJ")); String relnName = conjValue(ccDep, sg); if (relnName.matches("[^a-zA-Z_]")) { continue; } edge.setRelation(UniversalGrammaticalRelations.getConj(relnName)); } } }
edge.setRelation(reln);
private static void addConjToReln(SemanticGraph sg, IndexedWord gov, List<IndexedWord> conjDeps, IndexedWord ccDep) { for (IndexedWord conjDep : conjDeps) { SemanticGraphEdge edge = sg.getEdge(gov, conjDep); if (edge.getRelation() == CONJUNCT || conjDep.index() > ccDep.index()) { edge.setRelation(conjValue(ccDep, sg)); } } }
/** * Post-process graph and copy over case markers in case the PP-complement * is conjoined. * @param sg */ public static void addCaseMarkerForConjunctions(SemanticGraph sg) { SemanticGraph sgCopy = sg.makeSoftCopy(); for (SemanticGraphEdge edge : sgCopy.edgeIterable()) { String relnName = edge.getRelation().toString(); if (relnName.equals("nmod") || relnName.equals("obl") || relnName.equals("acl") || relnName.equals("advcl")) { Set<IndexedWord> conjParents = sg.getParentsWithReln(edge.getDependent(), "conj"); for (IndexedWord conjParent : conjParents) { List<SemanticGraphEdge> conjParentIncomingEdges = sg.getIncomingEdgesSorted(conjParent); boolean changed = false; for (SemanticGraphEdge edge1: conjParentIncomingEdges) { if (edge1.getRelation().toString().startsWith(relnName) && edge1.getRelation().getSpecific() != null) { changed = true; sg.getEdge(edge.getGovernor(), edge.getDependent(), edge.getRelation()).setRelation(edge1.getRelation()); break; } } if (changed) { break; } } } } }
|| nmod.getGovernor().tag().startsWith("PRN") || nmod.getGovernor().tag().startsWith("DT")) { nmod.setRelation(NOMINAL_MODIFIER); } else { nmod.setRelation(OBLIQUE_MODIFIER); prep.setRelation(OBLIQUE_MODIFIER); edge.setRelation(DIRECT_OBJECT);
private static void addPassiveAgentToReln(SemanticGraph sg, IndexedWord gov, IndexedWord mod, IndexedWord caseMarker) { SemanticGraphEdge edge = sg.getEdge(gov, mod); GrammaticalRelation reln = UniversalEnglishGrammaticalRelations.getNmod("agent"); edge.setRelation(reln); }
private static void addPassiveAgentToReln(SemanticGraph sg, IndexedWord gov, IndexedWord mod, IndexedWord caseMarker) { SemanticGraphEdge edge = sg.getEdge(gov, mod); GrammaticalRelation reln = UniversalEnglishGrammaticalRelations.getNmod("agent"); edge.setRelation(reln); }
private static void addConjToReln(SemanticGraph sg, IndexedWord gov, List<IndexedWord> conjDeps, IndexedWord ccDep) { for (IndexedWord conjDep : conjDeps) { SemanticGraphEdge edge = sg.getEdge(gov, conjDep); if (edge.getRelation() == CONJUNCT || conjDep.index() > ccDep.index()) { edge.setRelation(conjValue(ccDep, sg)); } } }
private static void addConjToReln(SemanticGraph sg, IndexedWord gov, List<IndexedWord> conjDeps, IndexedWord ccDep) { for (IndexedWord conjDep : conjDeps) { SemanticGraphEdge edge = sg.getEdge(gov, conjDep); if (edge.getRelation() == CONJUNCT || conjDep.index() > ccDep.index()) { edge.setRelation(conjValue(ccDep, sg)); } } }
nmod.setRelation(NOMINAL_MODIFIER); prep.setRelation(NOMINAL_MODIFIER); edge.setRelation(DIRECT_OBJECT);
nmod.setRelation(NOMINAL_MODIFIER); prep.setRelation(NOMINAL_MODIFIER); edge.setRelation(DIRECT_OBJECT);