Package edu.pitt.terminology.lexicon

Examples of edu.pitt.terminology.lexicon.Annotation


        //String w = TextTools.normalize(a.getText(),true);
        // this word was encountered before, saved previous annoation
        // if the gap between last word and next word is more then 2 words,
        // it must be a seperate mention and deserves a seperate annotation
        if(lastWordOffset > -1 && (offs-lastWordOffset) > 2){
          Annotation an = new Annotation();
          an.setSearchString(text);
          an.setConcept(c);
          an.setOffset(st);
          an.setText(text.substring(st,en));
          list.add(an);
          //usedWords.clear();
          st = -1;
        }
       
        // start w/ first annotation
        if(st < 0)
          st = a.getStartPosition();
        // remember end position
        en = a.getEndPosition();
       
        //usedWords.add(w);
        lastWordOffset = offs;
      }
      // finish last annotation
      if(st >= 0 && en >= 0){
        Annotation an = new Annotation();
        an.setSearchString(text);
        an.setConcept(c);
        an.setOffset(st);
        an.setText(text.substring(st,en));
        list.add(an);
      }
    }catch(Exception ex){
      System.err.println("match: "+c.getMatchedTerm()+" | name: "+c.getName()+" | code: "+c.getCode());
      System.err.println("annotations: "+Arrays.toString(c.getAnnotations()));
View Full Code Here


    }
   
    // add annotations
    if(!annotations.isEmpty()){
      String txt = getConcept().getSearchString();
      Annotation a = getAnnotations().isEmpty()?null:getAnnotations().get(0);
      int offs = 0;
      if(a != null)
        offs = a.getOffset()-txt.length();
      offs = doc.getText().indexOf(txt,offs);
      if(offs > -1){
        for(Annotation b: annotations){
          if(b.getOffset() < txt.length()) //offs
            b.updateOffset(offs);
View Full Code Here

   */
  private void filterValues(ItemInstance item, List<Annotation> anat) {
    // remove annotations that happen to be part of other annotations
    // Ex: annotations: 6 and 10 where 10 is part of per 10 hpf
    for(ListIterator<Annotation> it=item.getAnnotations().listIterator();it.hasNext();){
      Annotation a = it.next();
      if(anat.contains(a))
        it.remove();
    }
  }
View Full Code Here

    List<Concept> r = new ArrayList<Concept>();
    List<Annotation> annotations = Arrays.asList(getConcept().getAnnotations());
    final int WINDOW = 4;
    int st = -1, en = -1;
    for(int i=0;i<doc.getAnnotations().size();i++){
      Annotation a = doc.getAnnotations().get(i);
      if(annotations.contains(a)){
        if(st == -1)
          st = i;
      }else if(st > -1){
        en = i;
        break;
      }
    }
    // now that we have the range
    if(st > -1){
      Map<Integer,Integer> offsets = new LinkedHashMap<Integer,Integer>();
      offsets.put(st-WINDOW,st);
      if(en > -1)
        offsets.put(en,en+WINDOW);
     
      for(int off: offsets.keySet()){
        for(int i=off;i>=0 && i<offsets.get(off) && i< doc.getAnnotations().size();i++){
          Annotation a = doc.getAnnotations().get(i);
          Concept c = a.getConcept();
          if(r.contains(c)){
            for(Concept b: r){
              if(!Arrays.asList(b.getAnnotations()).contains(a)){
                r.add(c);
                break;
View Full Code Here

    Relation relation = new Relation("isa");
    c.getRelatedConcepts(relation);
    c.getRelationMap();
    c.getRelations();

    Annotation annots[] = c.getAnnotations();
    c.getParentConcepts();
    edu.pitt.terminology.lexicon.Concept[] children = c
        .getChildrenConcepts();
    Definition[] definitions = c.getDefinitions();
    String[] matchedTerms = c.getMatchedTerms();
View Full Code Here

TOP

Related Classes of edu.pitt.terminology.lexicon.Annotation

Copyright © 2018 www.massapicom. 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.