Package edu.pitt.dbmi.nlp.noble.util

Examples of edu.pitt.dbmi.nlp.noble.util.PathHelper


   * @param doc
   * @return
   */
  public List<ItemInstance> process(TemplateDocument doc) throws TerminologyException{
    List<ItemInstance> items = new ArrayList<ItemInstance>();
    PathHelper paths = getPathHelper();
    // first pass
    for(Mention m: doc.getMentions()){
      Concept c = m.getConcept();
      if(paths.hasAncestor(c,getConcept())){
        ItemInstance item =  new ItemInstance(this,m);
        item.process(doc);
        if(item.isSatisfied()){
          addInstance(paths, items, item);
        }
      }else if(concept.getCodes() != null && !concept.getCodes().isEmpty() && c.getSources().length > 0){
        // what if there is a linkage code
        String code = concept.getCode(c.getSources()[0]);
        if(code != null){
          Concept cc = (code.equals(c.getSources()[0].getName()))?c.getTerminology().getRootConcepts()[0]:c.getTerminology().lookupConcept(code);
          if(cc != null){
            if(paths.hasAncestor(c,cc)){
              ItemInstance item = new ItemInstance(this,m);
              item.process(doc);
              if(item.isSatisfied())
                addInstance(paths, items, item);
            }
          }
        }
      }
    }
   
    // second pass, if nothing was found and there is a more general feature available
    if(items.isEmpty() && feature != null){
      for(Mention m: doc.getMentions()){
        Concept c = m.getConcept();
        if(paths.hasAncestor(c,getFeature().getConcept())){
          // process this template with feature concept
          ItemInstance item = new ItemInstance(this,m);
          item.process(doc);
         
          // process a feature template with feature concept
View Full Code Here


   * get path helper to determine the hiearchy between concepts
   * @return
   */
  public PathHelper getPathHelper() {
    if(pathHelper == null){
      pathHelper = new PathHelper(getTerminology());
    }
    return pathHelper;
  }
View Full Code Here

   * @return
   */
  public void process(TemplateDocument doc) throws TerminologyException{
    this.doc = doc;
    satisfied = true;
    PathHelper paths = getTemplateItem().getTemplate().getPathHelper();
   
    // parse additional text to extract meaning
    List<Concept> r = getNeighbors(doc);
    List<Annotation> annotations = new ArrayList<Annotation>();
   
    // check if DOMAIN has triggers and invalidate it if
    // not there
    if(TemplateItem.DOMAIN_TRIGGER.equals(templateItem.getValueDomain())){
      // check if there are mentions in the same sentence
      // that match any of the values
      for(TemplateItem a: templateItem.getAttributeValues().keySet()){
        satisfied = false;
        for(TemplateItem v: templateItem.getAttributeValues(a)){
          for(Mention m: mention.getSentence().getMentions()){
            if(paths.hasAncestor(m.getConcept(),v.getConcept())){
              addAttributeValue(new ItemInstance(a,a.getConcept()),new ItemInstance(v,m));
              annotations.addAll(m.getAnnotations());
              satisfied = true;
            }
          }
View Full Code Here

    printInfo(terminology);
   
    // doing ancestry index
    if(createAncestry){
      log("Creating Ancestry Cache for "+name+" ..,");
      PathHelper ph = new PathHelper(terminology);
      ph.createAncestryCache();
    }
   
   
    log("\n\nAll Done!");
  }
View Full Code Here

    add(status,BorderLayout.SOUTH);
  }
 
  private PathHelper getPathHelper(){
    if(pathHelper == null && terminology != null){
      pathHelper = new PathHelper(terminology);
    }
    return pathHelper;
  }
View Full Code Here

TOP

Related Classes of edu.pitt.dbmi.nlp.noble.util.PathHelper

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.