private static boolean isBe (TreebankNode n) { String phCat = n.getNodeType(); String txt = n.getCoveredText(); if ((phCat.equals("VB") || phCat.equals("VBZ") || phCat.equals("VBD") || phCat.equals("VBN")) && (txt.equalsIgnoreCase("is") || txt.equalsIgnoreCase("was") || txt.equalsIgnoreCase("been") || txt.equalsIgnoreCase("be"))) return true; return false; }
private static boolean isBe (TreebankNode n) { String phCat = n.getNodeType(); String txt = n.getCoveredText(); if ((phCat.equals("VB") || phCat.equals("VBZ") || phCat.equals("VBD") || phCat.equals("VBN")) && (txt.equalsIgnoreCase("is") || txt.equalsIgnoreCase("was") || txt.equalsIgnoreCase("been") || txt.equalsIgnoreCase("be"))) return true; return false; }
treebankNodeSizes.put(treebankNode, treebankNode.getCoveredText().length()); return sortedTreebankNodes.get(0).getCoveredText();
treebankNodeSizes.put(treebankNode, treebankNode.getCoveredText().length()); return sortedTreebankNodes.get(0).getCoveredText();
treebankNodeSizes.put(treebankNode, treebankNode.getCoveredText().length());
treebankNodeSizes.put(treebankNode, treebankNode.getCoveredText().length());
String s = node.getCoveredText().toLowerCase(); if (s.startsWith("his ") || s.startsWith("her ") ||
String s = node.getCoveredText().toLowerCase(); if (s.startsWith("his ") || s.startsWith("her ") ||
if (isBe(firstChild)) { TreebankNode adjP = findP(vp, "ADJP", 1); if (adjP!=null && modalAdj.contains(adjP.getCoveredText()) && (findP(vp, "SBAR", 1)!=null || findP(vp, "S", 1)!=null || } else if (isBe(par.getChildren(0))) { firstChild = vp.getChildren(0); if (firstChild!=null && cogved.contains(firstChild.getCoveredText()) && (findP(vp, "SBAR", 1)!=null || findP(vp, "S", 1)!=null)) String word = firstChild.getCoveredText().replaceAll("s$", "").replaceAll("ed$", "").replaceAll("t$", ""); if (othervb.contains(word) && (findP(vp, "SBAR", 1)!=null ||
@Override public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs( JCas identifiedAnnotationView, Annotation sentence) { List<IdentifiedAnnotationPair> pairs = super.getCandidateRelationArgumentPairs(identifiedAnnotationView, sentence); // find pairs enclosed inside a noun phrase List<IdentifiedAnnotationPair> result = new ArrayList<IdentifiedAnnotationPair>(); for(IdentifiedAnnotationPair pair : pairs) { if(Utils.validateDegreeOfArgumentTypes(pair)) { for(TreebankNode nounPhrase : Utils.getNounPhrases(identifiedAnnotationView, (Sentence) sentence)) { if(Utils.isEnclosed(pair, nounPhrase)) { IdentifiedAnnotation arg1 = pair.getArg1(); IdentifiedAnnotation arg2 = pair.getArg2(); result.add(new IdentifiedAnnotationPair(arg1, arg2)); System.out.println("NP: " + nounPhrase.getCoveredText() + ", " + nounPhrase.getBegin() + ", " + nounPhrase.getEnd()); System.out.println("arg1: " + arg1.getCoveredText() + ", " + arg1.getBegin() + ", " + arg1.getEnd()); System.out.println("arg2: " + arg2.getCoveredText() + ", " + arg2.getBegin() + ", " + arg2.getEnd()); System.out.println(); break; // don't check other NPs } } } } return result; } }
@Override public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs( JCas identifiedAnnotationView, Annotation sentence) { List<IdentifiedAnnotationPair> pairs = super.getCandidateRelationArgumentPairs(identifiedAnnotationView, sentence); // find pairs enclosed inside a noun phrase List<IdentifiedAnnotationPair> result = new ArrayList<IdentifiedAnnotationPair>(); for(IdentifiedAnnotationPair pair : pairs) { if(Utils.validateDegreeOfArgumentTypes(pair)) { for(TreebankNode nounPhrase : Utils.getNounPhrases(identifiedAnnotationView, (Sentence) sentence)) { if(Utils.isEnclosed(pair, nounPhrase)) { IdentifiedAnnotation arg1 = pair.getArg1(); IdentifiedAnnotation arg2 = pair.getArg2(); result.add(new IdentifiedAnnotationPair(arg1, arg2)); System.out.println("NP: " + nounPhrase.getCoveredText() + ", " + nounPhrase.getBegin() + ", " + nounPhrase.getEnd()); System.out.println("arg1: " + arg1.getCoveredText() + ", " + arg1.getBegin() + ", " + arg1.getEnd()); System.out.println("arg2: " + arg2.getCoveredText() + ", " + arg2.getBegin() + ", " + arg2.getEnd()); System.out.println(); break; // don't check other NPs } } } } return result; } }
if (isBe(firstChild)) { TreebankNode adjP = findP(vp, "ADJP", 1); if (adjP!=null && modalAdj.contains(adjP.getCoveredText()) && (findP(vp, "SBAR", 1)!=null || findP(vp, "S", 1)!=null || } else if (isBe(par.getChildren(0))) { firstChild = vp.getChildren(0); if (firstChild!=null && cogved.contains(firstChild.getCoveredText()) && (findP(vp, "SBAR", 1)!=null || findP(vp, "S", 1)!=null)) String word = firstChild.getCoveredText().replaceAll("s$", "").replaceAll("ed$", "").replaceAll("t$", ""); if (othervb.contains(word) && (findP(vp, "SBAR", 1)!=null ||
String nodeText = tree.getCoveredText();
String nodeText = tree.getCoveredText();
IdentifiedAnnotation arg2 = pair.getArg2(); result.add(new IdentifiedAnnotationPair(arg1, arg2)); System.out.println("NP: " + nounPhrase.getCoveredText() + ", " + nounPhrase.getBegin() + ", " + nounPhrase.getEnd()); System.out.println("arg1: " + arg1.getCoveredText() + ", " + arg1.getBegin() + ", " + arg1.getEnd()); System.out.println("arg2: " + arg2.getCoveredText() + ", " + arg2.getBegin() + ", " + arg2.getEnd());
IdentifiedAnnotation arg2 = pair.getArg2(); result.add(new IdentifiedAnnotationPair(arg1, arg2)); System.out.println("NP: " + nounPhrase.getCoveredText() + ", " + nounPhrase.getBegin() + ", " + nounPhrase.getEnd()); System.out.println("arg1: " + arg1.getCoveredText() + ", " + arg1.getBegin() + ", " + arg1.getEnd()); System.out.println("arg2: " + arg2.getCoveredText() + ", " + arg2.getBegin() + ", " + arg2.getEnd());