Package uk.ac.cam.ch.wwmm.oscar3.dataparse

Examples of uk.ac.cam.ch.wwmm.oscar3.dataparse.RPNode


    }   
  }

  private boolean resolveVsNewPubChem(ProcessState state, String name) {
    try {
      NewPubChem npc = NewPubChem.getInstance();
      if(npc != null) {
        String [] results = npc.getShortestSmilesAndInChI(name);
        if(results == null) return false;
        state.smiles = results[0];
        state.inchi = results[1];
        if(state.smiles != null) setNEAttribute(state.ne, "SMILES", state.smiles);
        if(state.inchi != null) setNEAttribute(state.ne, "InChI", state.inchi);
View Full Code Here


      }
      return;
    }
   
    if(mode.equals("BuildPubChem")) {
      new NewPubChem().initialise();
      return;
    }
   
    if(mode.equals("Server")) {
      if(Oscar3Props.getInstance().serverType.equals("none")) {
View Full Code Here

    String type = a.type;
    //System.out.println(surface + " " + a.type);
    if(type.contains("_")) {
      type = type.split("_")[0];
    }
    NamedEntity ne = new NamedEntity(t.getTokens(a.startToken, endToken), surface, type);
    assert(collector instanceof NECollector);
    ((NECollector)collector).collect(ne);
    //System.out.println(surface + ": " + a.reps);
    if(a.type.startsWith("ONT")) {
      Set<String> ontIds = runAutToStateToOntIds.get(a.type).get(a.state);
      String s = OntologyTerms.idsForTerm(surface);
      if(s != null && s.length() > 0) {
        if(ontIds == null) ontIds = new HashSet<String>();
        ontIds.addAll(StringTools.arrayToList(s.split("\\s+")));       
      }
      ne.addOntIds(ontIds);
      //System.out.println(surface + "\t" + ontIds);
    }
    if(a.type.startsWith("CUST")) {
      Set<String> custTypes = runAutToStateToOntIds.get(a.type).get(a.state);
      ne.addCustTypes(custTypes);
      //System.out.println(surface + "\t" + ontIds);
    }
    //ne.setPattern(StringTools.collectionToString(a.getReps(), "_"));
  }
View Full Code Here

    String type = a.type;
    //System.out.println(surface + " " + a.type);
    if(type.contains("_")) {
      type = type.split("_")[0];
    }
    NamedEntity ne = new NamedEntity(t.getTokens(a.startToken, endToken), surface, type);
    assert(collector instanceof NECollector);
    ((NECollector)collector).collect(ne);
    //System.out.println(surface + ": " + a.reps);
    if(a.type.startsWith("ONT")) {
      Set<String> ontIds = runAutToStateToOntIds.get(a.type).get(a.state);
      String s = OntologyTerms.idsForTerm(StringTools.normaliseName(surface));
      if(s != null && s.length() > 0) {
        if(ontIds == null) ontIds = new HashSet<String>();
        ontIds.addAll(StringTools.arrayToList(s.split("\\s+")));       
      }
      ne.addOntIds(ontIds);
      //System.out.println(surface + "\t" + ontIds);
    }
    if(a.type.startsWith("CUST")) {
      //System.out.println(runAutToStateToOntIds.get(a.type));
      Set<String> custTypes = runAutToStateToOntIds.get(a.type).get(a.state);
      ne.addCustTypes(custTypes);
      //System.out.println(surface + "\t" + ontIds);
    }

    //ne.setPattern(StringTools.collectionToString(a.getReps(), "_"));
  }
View Full Code Here

        String value = token.getValue();
        value = value.toLowerCase();
        if(prwStrings.contains(value)) {
          List<Token> neTokens = new ArrayList<Token>();
          neTokens.add(token);
          NamedEntity ne = new NamedEntity(neTokens, token.getValue(), "PRW");
          safholder.appendChild(ne.toSAF());
          //System.out.println("**********");
        }
      }
      //System.out.println();
    }
 
View Full Code Here

          } else {
            featuresForAbbrev = new ArrayList<String>();
            abbrevFeatures.put(ne.getSurface(), featuresForAbbrev);
          }
          if(neByLastToken.containsKey(prev2)) {
            NamedEntity maybeAbbrev = neByLastToken.get(prev2);
            String abbrMode = "abbr1:";
            if(StringTools.testForAcronym(surf, maybeAbbrev.getSurface())) {
              abbrMode = "abbr2:";
            }
            if(surf.matches(".*\\s.*")) abbrMode += "wws:";
            for(double lthresh = -5.0;lthresh < 5.05;lthresh += 0.5) {
              double thresh = logitToProb(lthresh);
              if(maybeAbbrev.getConfidence() > thresh) {
                featuresForAbbrev.add(abbrMode + "abbr>" + thresh);
              } else {
                featuresForAbbrev.add(abbrMode + "abbr<" + thresh);
              }             
            }
View Full Code Here

 
  private static NamedEntity makeNE(List<Token> neTokens, String neType) {
    Token firstToken = neTokens.get(0);
    Token lastToken = neTokens.get(neTokens.size()-1);
    String surf = firstToken.getTokenSequence().getSubstring(firstToken.getId(), lastToken.getId());
    return new NamedEntity(neTokens, surf, "GENIA-" + neType);
  }
View Full Code Here

      }
    }
  }
 
  Document annotateDoc(Document doc) throws Exception {
    ProcessingDocument procDoc = ProcessingDocumentFactory.getInstance().makeTokenisedDocument(doc, false, false, false);
    //NameRecogniser nr = new NameRecogniser();
    //nr.halfProcess(doc);
    //nr.makeTokenisers(false);
    Element safholder = new Element("saf");
    Document safDoc = new Document(safholder);
    for(TokenSequence t : procDoc.getTokenSequences()) {
      for(Token token : t.getTokens()) {
        //System.out.println(token.getValue());
        String value = token.getValue();
        value = value.toLowerCase();
        if(prwStrings.contains(value)) {
View Full Code Here

    /*NameRecogniser nr = new NameRecogniser();
    nr.halfProcess(doc);

    nr.makeTokenisers(false);*/
   
    ProcessingDocument procDoc = ProcessingDocumentFactory.getInstance().makeTokenisedDocument(doc, true, false, false);
   
    List<NamedEntity> entities = new ArrayList<NamedEntity>();

    Set<String> testNEs = new HashSet<String>();
   
    for(TokenSequence tokSeq : procDoc.getTokenSequences()) {
      Nodes neNodes = tokSeq.getElem().query(".//ne");
      for(int k=0;k<neNodes.size();k++) {
        Element neElem = (Element)neNodes.get(k);
        String neStr = "[NE:" + neElem.getAttributeValue("type") + ":" + neElem.getAttributeValue("xtspanstart") + ":" + neElem.getAttributeValue("xtspanend") + ":" + neElem.getValue() + "]";
        testNEs.add(neStr);
View Full Code Here

   
    /*NameRecogniser nr = new NameRecogniser();
    nr.halfProcess(doc);

    nr.makeTokenisers(false);*/
    ProcessingDocument procDoc = ProcessingDocumentFactory.getInstance().makeTokenisedDocument(doc, true, false, false);
   
    List<NamedEntity> entities = new ArrayList<NamedEntity>();

    Set<String> testNEs = new HashSet<String>();
   
    for(TokenSequence tokSeq : procDoc.getTokenSequences()) {
      Nodes neNodes = tokSeq.getElem().query(".//ne");
      for(int k=0;k<neNodes.size();k++) {
        Element neElem = (Element)neNodes.get(k);
        String neStr = "[NE:" + neElem.getAttributeValue("type") + ":" + neElem.getAttributeValue("xtspanstart") + ":" + neElem.getAttributeValue("xtspanend") + ":" + neElem.getValue() + "]";
        testNEs.add(neStr);
View Full Code Here

TOP

Related Classes of uk.ac.cam.ch.wwmm.oscar3.dataparse.RPNode

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.