Package uk.ac.cam.ch.wwmm.oscar3.recogniser.document

Examples of uk.ac.cam.ch.wwmm.oscar3.recogniser.document.ProcessingDocument


    }
    Bag<String> allTerms = new Bag<String>();
    String word = "reduction";
    List<File> files = FileTools.getFilesFromDirectoryByName(new File("/home/ptc24/newows/corpora/BioIE"), "source.xml");
    //List<File> files = FileTools.getFilesFromDirectoryByName(new File("/scratch/pubmed/2005"), "source.xml");
    TokenSequenceSource ts = new TokenSequenceSource(files);
    for(TokenSequence t : ts) {
      List<String> tokens = t.getTokenStringList();
      for(int i=0;i<tokens.size();i++) {
        if(tokens.get(i).equals(word)) {
          for(int j=Math.max(0, i-windowSize);j<=Math.min(i+windowSize,tokens.size()-1);j++) {
View Full Code Here


   * @throws Exception
   */
  public static Document makeModel() throws Exception {
    Element modelRoot = new Element("model");
    modelRoot.appendChild(ExtractTrainingData.getInstance().toXML());
    MEMM memm = MEMMSingleton.getInstance();
    if(memm != null) modelRoot.appendChild(memm.writeModel());
    NESubtypes subtypes = NESubtypes.getInstance();
    if(subtypes.OK) modelRoot.appendChild(subtypes.toXML());
    return new Document(modelRoot);
  }
View Full Code Here

      }     
    }*/
  }

  void trainOnSbFilesWithRescore(List<File> files, Map<File,String> domains) throws Exception {
    rescorer = new RescoreMEMMOut();
    List<List<File>> splitTrainFiles = new ArrayList<List<File>>();
    List<List<File>> splitTrainAntiFiles = new ArrayList<List<File>>();
    int splitNo = 3;
   
    for(int i=0;i<splitNo;i++) {
View Full Code Here

        tagSet.add(gm.getOutcome(j));
      }
    }
    Element rescorerElem = memmRoot.getFirstChildElement("rescorer");
    if(rescorerElem != null) {
      rescorer = new RescoreMEMMOut();
      rescorer.readElement(rescorerElem);
    } else {
      rescorer = null;
    }
    makeEntityTypesAndZeroProbs();
View Full Code Here

    //System.out.println(logAdd(-1000, -1000));
   
    //if(true) return;
   
    NGramBuilder ng = NGramBuilder.getInstance();
    ng.engSet.removeAll(ng.chemSet);
    Map<String,Boolean> isChem = new HashMap<String,Boolean>();
    for(String chem : ng.chemSet) {
      isChem.put(chem, true);
    }
View Full Code Here

  }
 
  private boolean resolveVsExternal(ProcessState state, String name) {
    if(extensionNameResolver == null) return false;
    try {
      Results results = extensionNameResolver.resolve(name, state.args);
      if(results != null) {
        state.smiles = results.getSmiles();
        state.inchi = results.getInchi();
        state.cmlMol = results.getCml();
        if(state.smiles != null) setNEAttribute(state.ne, "SMILES", state.smiles);
        if(state.inchi != null) setNEAttribute(state.ne, "InChI", state.inchi);
        if(state.smiles != null && Oscar3Props.getInstance().cacheExtensionNameResolver) {
          cacheEntry(name, state.smiles, state.inchi, state.cmlMol);
        }
View Full Code Here

  public static Document makeModel() throws Exception {
    Element modelRoot = new Element("model");
    modelRoot.appendChild(ExtractTrainingData.getInstance().toXML());
    MEMM memm = MEMMSingleton.getInstance();
    if(memm != null) modelRoot.appendChild(memm.writeModel());
    NESubtypes subtypes = NESubtypes.getInstance();
    if(subtypes.OK) modelRoot.appendChild(subtypes.toXML());
    return new Document(modelRoot);
  }
View Full Code Here

    long time = System.currentTimeMillis();
    ResourceGetter rg = new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/chemnamedict/resources/");
   
    Set<String> stops = rg.getStringSet("ChEBIStop.txt");
   
    OBOOntology o = OBOOntology.getInstance();

    Map<String,Set<String>> relatedBySource = new HashMap<String,Set<String>>();
   
    for(String id : o.getTerms().keySet()) {
      if(!id.startsWith("CHEBI:")) continue;
      //if(id.equals("CHEBI:16243")) System.out.println("foo!");
      OntologyTerm term = o.getTerms().get(id);
      Set<String> names = new LinkedHashSet<String>();
      names.add(term.getName());
      String inchi = null;
      String smiles = null;
      //System.out.println(term.getName());
View Full Code Here

    }
  }
 
  private Bag<String> expandOntologyBag(Bag<String> ontologyBag) {
    Bag<String> results = new Bag<String>();
    OBOOntology oo = OBOOntology.getInstance();
    for(String id : ontologyBag.getSet()) {
      for(String parent : oo.getIdsForIdWithAncestors(id)) {
        results.add(parent, ontologyBag.getCount(id));
      }
    }
    return results;
  }
View Full Code Here

    Map<String,Set<String>> relatedBySource = new HashMap<String,Set<String>>();
   
    for(String id : o.getTerms().keySet()) {
      if(!id.startsWith("CHEBI:")) continue;
      //if(id.equals("CHEBI:16243")) System.out.println("foo!");
      OntologyTerm term = o.getTerms().get(id);
      Set<String> names = new LinkedHashSet<String>();
      names.add(term.getName());
      String inchi = null;
      String smiles = null;
      //System.out.println(term.getName());
      for(Synonym s : term.getSynonyms()){
        //if(id.equals("CHEBI:16243")) System.out.println(s);
        //System.out.println("\t" + s);
        if(s.getType().equals("RELATED InChI")) {
          inchi = s.getSyn();
        } else if(s.getType().equals("RELATED SMILES")) {
View Full Code Here

TOP

Related Classes of uk.ac.cam.ch.wwmm.oscar3.recogniser.document.ProcessingDocument

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.