Package edu.pitt.terminology.lexicon

Examples of edu.pitt.terminology.lexicon.Term


              prefNameSource = null;
            }
          }
         
          // create a term
          Term term = new Term(text);
          term.setForm(form);
          term.setLanguage(lang);
          term.setSource(source);
          if("y".equalsIgnoreCase(pref) && "P".equalsIgnoreCase(ts))
            term.setPreferred(true);
         
          // add to concept
          c.addSynonym(text);
          c.addSource(source);
          c.addTerm(term);
          c.addCode(code, source);
         
          // set preferred name for the first time
          if(term.isPreferred()){
            // if prefered name source is not set OR
            // we have filtering and the new source offset is less then old source offset (which means higher priority)
            if(prefNameSource == null || (filterSources != null && filterSources.indexOf(src) < filterSources.indexOf(prefNameSource))){
              c.setName(text);
              prefNameSource = src;
View Full Code Here


            if("id".equals(key)){
              c.setCode(val);
            }else if("name".equals(key)){
              c.setSynonyms(new String [0]);
              c.setName(val);
              Term t = Term.getTerm(val);
              t.setPreferred(true);
              c.addTerm(t);
            }else if("namespace".equals(key)){
              c.addSemanticType(SemanticType.getSemanticType(val));
            }else if("def".equals(key)){
              Matcher m = p.matcher(val);
              if(m.matches())
                val = m.group(1);
              c.addDefinition(Definition.getDefinition(val));
            }else if(key != null && key.matches("(exact_|narrow_|broad_)?synonym")){
              Matcher m = p.matcher(val);
              String form = null;
              if(m.matches()){
                val = m.group(1);
                form = m.group(2);
              }
              Term t = Term.getTerm(val);
              if(form != null)
                t.setForm(form);
              c.addTerm(t);
            }else if("is_a".equals(key)){
              int j = val.indexOf("!");
              if(j > -1)
                val = val.substring(0,j).trim();
View Full Code Here

        tgtConcept.setBegin(annotationRange[0]);
        tgtConcept.setEnd(annotationRange[1]);
        tgtConcept.setCui(srcConcept.getCode());
        tgtConcept.setCn(srcConcept.getName());
        tgtConcept.setDefinition(srcConcept.getDefinition());
        Term preferredTerm = srcConcept.getPreferredTerm();
        if (preferredTerm != null) {
          tgtConcept.setPreferredTerm(srcConcept
              .getPreferredTerm().getText());
        }
        populateSemanticTypes(jCas, srcConcept, tgtConcept);
View Full Code Here

                    }
                  }
                }
               
                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);
                }
              }
            }
          }
View Full Code Here

      Set<Source> sources = new HashSet<Source>();
      Set<Term> terms = new HashSet<Term>();
      Set<SemanticType> semanticTypes = new LinkedHashSet<SemanticType>();
      Set<Definition> definitions = new LinkedHashSet<Definition>();
      Map<String, Source> codes = new HashMap<String,Source>();
      Term preferred = null;
     
      // lookup main concept info
      PreparedStatement st = con.prepareStatement("SELECT * FROM mrconso WHERE cui = ? "+((lang != null)?" AND lat = ?":""));
      st.setString(1,cui);
      if(lang != null)
        st.setString(2,lang);
      ResultSet result =  st.executeQuery();
      while(result.next()){
        String src  = result.getString("sab");
        String text = result.getString("str");
        String lang = result.getString("lat");
        String form = result.getString("tty");
        String code = result.getString("code");
        String pref = result.getString("ispref");
        Source source = Source.getSource(src);
       
        Term term = new Term(text);
        term.setForm(form);
        term.setLanguage(lang);
        term.setSource(source);
        if("y".equalsIgnoreCase(pref))
          term.setPreferred(true);
       
        synonyms.add(text);
        sources.add(source);
        terms.add(term);
        codes.put(code,source);
       
        if(preferred == null && term.isPreferred())
          preferred = term;
      }
      result.close();
      st.close();
     
View Full Code Here

        if(mt.matches()){
          String text  = mt.group(1);
          String group = mt.group(2);
          String src   = mt.group(3);
         
          Term term = new Term(text);
          term.setForm(group);
          term.setSource(new Source(src));
         
          terms.add(term);
          syns.add(text);
        }
      }
View Full Code Here

TOP

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

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.