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

Examples of uk.ac.cam.ch.wwmm.oscar3.terms.OntologyTerm


    Collections.sort(offsetArray, offsetComparator);
    System.out.println(System.currentTimeMillis() - time)
  }
 
  public int [] searchForString(String searchString) {
    TokenSequence ts = Tokeniser.getInstance().tokenise(searchString);
    List<Integer> tsl = new ArrayList<Integer>(ts.size() + 1);
    for(Token t : ts.getTokens()) {
      String s = t.getValue().toLowerCase();
      if(tokenIndex.containsKey(s)) {
        tsl.add(tokenIndex.get(s));
      } else {
        return null;
View Full Code Here


      Token token = procDoc.getTokenByStart(e.getAttributeValue("from"));
      if(token == null) token = procDoc.getTokenByEnd(e.getAttributeValue("to"));
      if(token == null) {
        System.out.println("Eeep!");
      } else {
        TokenSequence tokSeq = token.getTokenSequence();
        boolean isReact = "REACT".equals(SafTools.getSlotValue(e, "subtype"));
        if(tokSeqs.containsKey(tokSeq)) {
          if(isReact) tokSeqs.put(tokSeq, true);
        } else {
          tokSeqs.put(tokSeq, isReact);
View Full Code Here

        c = reader.read();
      }     
    } catch (Exception e) {
      throw new Error(e);
    }
    TokenSequence t = Tokeniser.getInstance().tokenise(sb.toString());
   
    TokenStream ts = new Oscar3TokenStream(t);
    ts = new Oscar3Filters(ts);
    return ts;
  }
View Full Code Here

      Token token = procDoc.getTokenByStart(e.getAttributeValue("from"));
      if(token == null) token = procDoc.getTokenByEnd(e.getAttributeValue("to"));
      if(token == null) {
        System.out.println("Eeep!");
      } else {
        TokenSequence tokSeq = token.getTokenSequence();
        //boolean isReact = "REACT".equals(SafTools.getSlotValue(e, "subtype"));
        boolean isPubmed = f.toString().contains("pubmed");
        if(tokSeqs.containsKey(tokSeq)) {
          if(isPubmed) tokSeqs.put(tokSeq, true);
        } else {
View Full Code Here

    //files = files.subList(0, 10);
   
   
    Bag<String> tokenBag = new Bag<String>();
   
    TokenSequenceSource tss = new TokenSequenceSource(files);
    int i=0;
    for(TokenSequence ts : tss) {
      for(Token t : ts.getTokens()) {
        tokenBag.add(t.getValue().intern());
      }
View Full Code Here

      corpusOffset++;
    }
  }
 
  public InverseSearcher(List<File> files) throws Exception {
    TokenSequenceSource tss = new TokenSequenceSource(files);

    corpusArray = new ArrayList<Integer>();
    offsetArray = new ArrayList<Integer>();
    tokenList = new ArrayList<String>();
    tokenIndex = new HashMap<String,Integer>();
View Full Code Here

    }
    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

TOP

Related Classes of uk.ac.cam.ch.wwmm.oscar3.terms.OntologyTerm

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.