int end = node.getEnd(); begin = child.getBegin(); if(child.getEnd() > end){ end = child.getEnd(); if(parent.getEnd() > node.getEnd() && parent.getEnd() < end){ BaseToken prevToken = JCasUtil.selectPreceding(BaseToken.class, parent, 1).get(0); end = prevToken.getEnd(); markable.addToIndexes(); }else if(node.getPostag().equals("DT") && !node.getDeprel().equals("det")){ Markable markable = new Markable(jCas, node.getBegin(), node.getEnd()); markable.addToIndexes(); }else if(node.getCoveredText().toLowerCase().equals("it") && node.getDeprel().contains("bj")){ Markable markable = new Markable(jCas, node.getBegin(), node.getEnd()); markable.addToIndexes();
markable.addToIndexes(); }else if(node.getPostag().equals("DT") && !node.getDeprel().equals("det")){ Markable markable = new Markable(jCas, node.getBegin(), node.getEnd()); markable.addToIndexes(); }else if(node.getCoveredText().toLowerCase().equals("it") && node.getDeprel().contains("bj")){ Markable markable = new Markable(jCas, node.getBegin(), node.getEnd()); markable.addToIndexes();
public String calcDepPath(){ if(depPath == null){ if(c1 == null || c2 == null || c2.getBegin() <= c1.getEnd()){ depPath = ""; }else{
/** * Finds the head word within a given annotation span */ public static ConllDependencyNode findAnnotationHead(JCas jcas, Annotation annotation) { for (ConllDependencyNode depNode : JCasUtil.selectCovered(jcas, ConllDependencyNode.class, annotation)) { ConllDependencyNode head = depNode.getHead(); if (head == null || head.getEnd() <= annotation.getBegin() || head.getBegin() > annotation.getEnd()) { // The head is outside the bounds of the annotation, so this node must be the annotation's head return depNode; } } // Can this happen? return null; }
/** * Finds the head word within a given annotation span */ public static ConllDependencyNode findAnnotationHead(JCas jcas, Annotation annotation) { for (ConllDependencyNode depNode : JCasUtil.selectCovered(jcas, ConllDependencyNode.class, annotation)) { ConllDependencyNode head = depNode.getHead(); if (head == null || head.getEnd() <= annotation.getBegin() || head.getBegin() > annotation.getEnd()) { // The head is outside the bounds of the annotation, so this node must be the annotation's head return depNode; } } // Can this happen? return null; }
public String calcDepPath(){ if(depPath == null){ if(c1 == null || c2 == null || c2.getBegin() <= c1.getEnd()){ depPath = ""; }else{
final Collection<IdentifiedAnnotation> annotations = nodeAnnotations.get( headNode ); if ( annotations == null || annotations.isEmpty() ) { spanMap.put( markable, new DefaultTextSpan( headNode.getBegin(), headNode.getEnd() ) ); continue; spanMap.put( markable, bestSpan ); } else { spanMap.put( markable, new DefaultTextSpan( headNode.getBegin(), headNode.getEnd() ) );
final Collection<IdentifiedAnnotation> annotations = nodeAnnotations.get( headNode ); if ( annotations == null || annotations.isEmpty() ) { spanMap.put( markable, new DefaultTextSpan( headNode.getBegin(), headNode.getEnd() ) ); continue; spanMap.put( markable, bestSpan ); } else { spanMap.put( markable, new DefaultTextSpan( headNode.getBegin(), headNode.getEnd() ) );
private static Markable getDoctorMarkable(JCas jcas, WordToken drToken){ Markable markable = null; ConllDependencyNode nnpHead = DependencyUtility.getDependencyNode(jcas, drToken); try{ while(nnpHead != null && nnpHead.getHead() != null && nnpHead.getHead().getId() != 0 && nnpHead.getHead().getPostag().equals("NNP")){ nnpHead = nnpHead.getHead(); } }catch(NullPointerException e){ System.err.print("."); } int start = drToken.getBegin(); int end = nnpHead.getEnd(); if(end < start) end = drToken.getEnd(); markable = new Markable(jcas, start, end); return markable; } }
private static Markable getDoctorMarkable(JCas jcas, WordToken drToken){ Markable markable = null; ConllDependencyNode nnpHead = DependencyUtility.getDependencyNode(jcas, drToken); try{ while(nnpHead != null && nnpHead.getHead() != null && nnpHead.getHead().getId() != 0 && nnpHead.getHead().getPostag().equals("NNP")){ nnpHead = nnpHead.getHead(); } }catch(NullPointerException e){ System.err.print("."); } int start = drToken.getBegin(); int end = nnpHead.getEnd(); if(end < start) end = drToken.getEnd(); markable = new Markable(jcas, start, end); return markable; } }