Examples of NEMarkable


Examples of org.apache.ctakes.coreference.type.NEMarkable

  public void process(JCas aJCas) throws AnalysisEngineProcessException {

    ArrayList<Annotation> la = AnnotationSelector.selectNE(aJCas);
    for (int i = 0; i < la.size(); ++i) {
      Annotation a = la.get(i);
      NEMarkable m = new NEMarkable(aJCas, a.getBegin(), a.getEnd());
      m.setContent(a);
      m.setId(nextID + i);
      m.addToIndexes();
    }

    nextID += la.size();

    ArrayList<WordToken> lw = AnnotationSelector.selectPronoun(aJCas, modalAdj, cogved, otherVerb, logger);
    for (int i = 0; i < lw.size(); ++i) {
      WordToken t = lw.get(i);
      PronounMarkable m = new PronounMarkable(aJCas, t.getBegin(), t.getEnd());
      m.setContent(t);
      m.setId(nextID + i);
      m.addToIndexes();
    }

    nextID += lw.size();

    ArrayList<Chunk> lc = AnnotationSelector.selectDemonAndRelative(aJCas);
    for (int i = 0; i < lc.size(); ++i) {
      Chunk c = lc.get(i);
      DemMarkable m = new DemMarkable(aJCas, c.getBegin(), c.getEnd());
      m.setContent(c);
      m.setId(nextID + i);
      m.addToIndexes();
    }

    nextID += lc.size();
  }
View Full Code Here

Examples of org.apache.ctakes.coreference.type.NEMarkable

    System.out.println("   ....ended with " + numVecs + " vectors.");
//    maxSpanID += sa.getMaxID();
  }

  private void createCorefPairs(LinkedList<Annotation> lm, int p, JCas jcas) {
    NEMarkable m = (NEMarkable) lm.get(p); // Current markable under consideration
    MarkablePairSet pairList = new MarkablePairSet(jcas);
    pairList.setBegin(m.getBegin());
    pairList.setEnd(m.getEnd());
    pairList.setAnaphor(m);
    NonEmptyFSList head = new NonEmptyFSList(jcas);
    pairList.setAntecedentList(head);
    NonEmptyFSList tail = null;
    for (int q = p-1; q>=0; --q) {
      Markable a = (Markable) lm.get(q); // Candidate antecedent

      // Don't link to a expletive
//      if (dnr.contains(m)) continue;
      // Look no more than 10 sentences
      int sentdist = sentDist(jcas, a, m);
      if (sentdist>CorefConsts.NEDIST) break;
//      else if (sentdist>PRODIST && m instanceof PronounMarkable) continue;
      // filter out if both are NEs but of diff types
      if (m.getContent() instanceof IdentifiedAnnotation &&
          a.getContent() instanceof IdentifiedAnnotation &&
          ((IdentifiedAnnotation)m.getContent()).getTypeID() != ((IdentifiedAnnotation)a.getContent()).getTypeID())
        continue;

      // filter out "which" that crosses sentence boundary
      if (a.getCoveredText().equalsIgnoreCase("which") &&
          sentDist(jcas, a, m)>=1)
        continue;
      // ban pairs that one markable is a sub/superspan of the other
      if ((a.getBegin()<=m.getBegin() && a.getEnd()>=m.getEnd()) ||
          m.getBegin()<=a.getBegin() && m.getEnd()>=a.getEnd())
        continue;
      // Create a vector
      BooleanLabeledFS labeledAntecedent = new BooleanLabeledFS(jcas);
      labeledAntecedent.setFeature(a);
      if(tail == null){
View Full Code Here

Examples of org.apache.ctakes.coreference.type.NEMarkable

  private void removeDoctors(JCas jCas) {
    FSIterator<Annotation> iter = jCas.getAnnotationIndex(NEMarkable.type).iterator();
    ArrayList<Annotation> rm = new ArrayList<Annotation>();
    while(iter.hasNext()){
      NEMarkable m = (NEMarkable) iter.next();
      if(m.getCoveredText().equalsIgnoreCase("dr")){
        rm.add(m);
      }
    }
    for(Annotation a: rm){
      a.removeFromIndexes();
View Full Code Here

Examples of org.apache.ctakes.coreference.type.NEMarkable

  private void removeHistoryOf(JCas jCas) {
    FSIterator<Annotation> iter = jCas.getAnnotationIndex(NEMarkable.type).iterator();
    ArrayList<Annotation> rm = new ArrayList<Annotation>();
    while(iter.hasNext()){
      NEMarkable m = (NEMarkable) iter.next();
      if(m.getCoveredText().equalsIgnoreCase("history of")){
        rm.add(m);
      }
    }
    for(Annotation a: rm){
      a.removeFromIndexes();
View Full Code Here

Examples of org.apache.ctakes.coreference.type.NEMarkable

   */

  private void elevateAdjectives(JCas jcas){
    FSIterator<Annotation> markables = jcas.getAnnotationIndex(NEMarkable.type).iterator();
    while(markables.hasNext()){
      NEMarkable mark = (NEMarkable) markables.next();
      TreebankNode node = MarkableTreeUtils.markableNode(jcas, mark.getBegin(), mark.getEnd());
      if(node.getNodeType().equals("JJ")){
        while(node.getNodeType().equals("JJ")){
          node = node.getParent();
          if(node == null) break;
        }
        if(node != null){
          mark.setBegin(node.getBegin());
          mark.setEnd(node.getEnd());
        }
      }
    }
     
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.