Package edu.pitt.dbmi.nlp.noble.terminology

Examples of edu.pitt.dbmi.nlp.noble.terminology.Concept


        setAbsent(true);
        annotations.add(mention.getModalityAnnotation());
      }
     
      // parse concept for its attributes and values
      Concept c = findConcept(templateItem.getFeature());
      if(c != null){
        Mention m = getMention(c);
        if(m != null)
          setFeature(new ItemInstance(templateItem.getFeature(),m));
      }
View Full Code Here


        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(b != null && !Arrays.asList(b.getAnnotations()).contains(a)){
                r.add(c);
                break;
View Full Code Here

        return super.add(e);
      }
     
    };
    for(TemplateItem mod: items){
      Concept c = (r == null)?findConcept(mod):findConcept(r,mod);
      if(c != null){
        result.add(new ItemInstance(mod,getMention(c,r == null)));
      }
    }
    return result;
View Full Code Here

   * @param out -
   * @param s
   * @return
   */
  private Concept findConcept(TemplateItem in){
    Concept c = in.getConcept();
    try{
      NobleCoderTerminology term = new NobleCoderTerminology();
      term.setIgnoreSmallWords(false);
      term.setScoreConcepts(false);
      term.setSelectBestCandidate(false);
      term.setIgnoreUsedWords(true);
      term.setCachingEnabled(false);
      term.addConcept(c);
     
      for(Concept rc: term.search(getConcept().getSearchString())){
        rc.setTerminology(c.getTerminology());
        return rc;
      }
    }catch(TerminologyException ex){
      //ex.printStackTrace();
     
View Full Code Here

 
  /**
   * lookup concept object based on CUI
   */
  public Concept lookupConcept(String cui) {
    Concept c = (Concept) sender.sendObject(filter(new Parcel("lookup_concept",cui)));
    if(c == null)
      return null;
    c.setTerminology(this);
    return c;
  }
View Full Code Here

        if("org.LexGrid.concepts.Concept".equals(name)){
          Map<String,Object> content = processElement(element);
         
          // setup some usefull values
          String cui   = ""+content.get("_entityCode");
          Concept concept = new Concept(cui);
          String preferredName = null;
         
          // set synonyms and terms
          List<Term> terms = new ArrayList<Term>();
          List<String> synonyms = new ArrayList<String>();
          Set<Source> sources = new HashSet<Source>();
          if(content.containsKey("_presentationList")){
            for(Map m: (List<Map>) content.get("_presentationList")){
              if("org.LexGrid.concepts.Presentation".equals(m.get("name"))){
                String pt = ""+m.get("_isPreferred");
                String text = null;
                String lang = (String) m.get("_language");
                String form = (String) m.get("_representationalForm");
                Source src = null;
               
                // get content
                Map tm = ((List<Map>) m.get("_value")).get(0);
                if("org.LexGrid.commonTypes.Text".equals(tm.get("name"))){
                  text = ""+tm.get("_content");
                  synonyms.add(text.trim());
                }
               
                // get source
                List<Map> sl = (List<Map>) m.get("_sourceList");
                if(sl != null && !sl.isEmpty()){
                  Map sm = sl.get(0);
                  if("org.LexGrid.commonTypes.Source".equals(sm.get("name"))){
                    String s = (String) sm.get("_content");
                    if(s != null){
                      src = new Source(s);
                      sources.add(src);
                    }
                  }
                }
               
                if(text != null){
                  Term term = new Term(text);
                  term.setPreferred(Boolean.parseBoolean(pt));
                  term.setLanguage(lang);
                  term.setForm(form);
                  if(src != null)
                    term.setSource(src);
                  terms.add(term);
                }
              }
            }
          }
         
          // set definitions and terms
          List<Definition> defs = new ArrayList<Definition>();
          if(content.containsKey("_definitionList")){
            for(Map m: (List<Map>) content.get("_definitionList")){
              if("org.LexGrid.concepts.Definition".equals(m.get("name"))){
                String text = null;
                Source src = null;
               
                Map tm = ((List<Map>) m.get("_value")).get(0);
                if("org.LexGrid.commonTypes.Text".equals(tm.get("name"))){
                  text = ""+tm.get("_content");
                }
                // get source
                List<Map> sl = (List<Map>) m.get("_sourceList");
                if(sl != null && !sl.isEmpty()){
                  Map sm = sl.get(0);
                  if("org.LexGrid.commonTypes.Source".equals(sm.get("name"))){
                    String s = (String) sm.get("_content");
                    if(s != null){
                      src = new Source(s);
                    }
                  }
                }
               
                if(text != null){
                  Definition d = new Definition(text);
                  if(src != null)
                    d.setSource(src);
                  defs.add(d);
                }
              }
            }
          }
         
          // set preferred name
          if(content.containsKey("_entityDescription")){
            for(Map m: (List<Map>) content.get("_entityDescription")){
              if("org.LexGrid.commonTypes.EntityDescription" .equals(m.get("name"))){
                preferredName = ""+m.get("_content");
              }
            }
          }
         
          // get properties
          // set definitions and terms
          Properties props = new Properties();
          if(content.containsKey("_propertyList")){
            for(Map m: (List<Map>) content.get("_propertyList")){
              if("org.LexGrid.commonTypes.Property".equals(m.get("name"))){
                String value = null;
                String prop = (String) m.get("_propertyName");
               
                Map tm = ((List<Map>) m.get("_value")).get(0);
                if("org.LexGrid.commonTypes.Text".equals(tm.get("name"))){
                  value =  (String) tm.get("_content");
                }
             
                if(prop != null && value != null){
                  props.setProperty(prop, value);
                }
              }
            }
          }
           
         
          // set name
          concept.setName(preferredName);
          concept.setTerminology(this);
          concept.setSynonyms(synonyms.toArray(new String [0]));
          concept.setTerms(terms.toArray(new Term [0]));
          concept.setDefinitions(defs.toArray(new Definition[0]));
          concept.setSources(sources.toArray(new Source [0]));
          concept.setProperties(props);
          if(props.containsKey("Semantic_Type")){
            concept.setSemanticTypes(new SemanticType []{SemanticType.getSemanticType(props.getProperty("Semantic_Type"))});
          }
         
          concept.setInitialized(true);
         
          return concept;
        }
      }
     
View Full Code Here

    //String server = "http://lexevsapi51.nci.nih.gov/lexevsapi51#NCI MetaThesaurus";
    Terminology term = new LexEVSRestTerminology(server);
    long time = System.currentTimeMillis();
    // ZFA_0001234 | C0025202
    System.out.println("--- lookup ---");
    Concept c = term.lookupConcept("C0025202");
    if(c != null){
      c.printInfo(System.out);
    }
    System.out.println("lookup time "+(System.currentTimeMillis()-time));
   
    System.out.println("--- search ---");
   
View Full Code Here

      // change ter
      if(preferred == null)
        preferred = terms.iterator().next();
     
      // stup concept
      Concept c = new Concept(cui);
      c.setTerminology(this);
      if(preferred != null)
        c.setName(preferred.getText());
      c.setSemanticTypes(semanticTypes.toArray(new SemanticType [0]));
      c.setSynonyms(synonyms.toArray(new String [0]));
      c.setSources(sources.toArray(new Source [0]));
      c.setTerms(terms.toArray(new Term [0]));
      c.setDefinitions(definitions.toArray(new Definition [0]));
      for(String code: codes.keySet())
        c.addCode(code,codes.get(code));
      c.setInitialized(true);
     
      return c;
     
    }catch(Exception ex){
      throw new TerminologyException("Error: Problem with lookup of "+cui,ex);
View Full Code Here

        ResultSet result =  st.executeQuery("SELECT DISTINCT cui, str FROM mrconso WHERE "+condition+filter);
        while(result.next()){
          String cui  = result.getString("cui");
          String str = result.getString("str");
         
          Concept c = new Concept(cui,str);
          c.setTerminology(this);
          c.setSearchString(text);
         
          if(!conceptList.contains(c))
            conceptList.add(c);
        }
        result.close();
View Full Code Here

  public static void main(String[] args) throws Exception {
    Terminology term = new UMLSTerminology("oracle.jdbc.driver.OracleDriver",
        "jdbc:oracle:thin:@lnx01.dbmi.pitt.edu:1521:dbmi01", "umls","dbmi09umls");
   
    // lookup concept
    Concept melanoma = term.lookupConcept("C0025202");
    melanoma.printInfo(System.out);
    term.setFilterSources(term.getSources("NCI"));
    System.out.println("--");
    // do search
    long time = System.currentTimeMillis();
    for(String text: new String [] {"blue tumor"}){
View Full Code Here

TOP

Related Classes of edu.pitt.dbmi.nlp.noble.terminology.Concept

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.