Package classification

Examples of classification.MappingPipeline


 
  public static void opt3(String source_dir, String op_dir, Boolean nercFlag)
  {
    gate.Document gateDoc = null;
    MLPipeline ml_p = new MLPipeline();
    MappingPipeline mp = null;
   
    try {
      if(nercFlag)
        mp = new MappingPipeline();
    } catch (MalformedURLException e1) {
    }
   
    ArrayList<File> fileList = RecurseFolder.getFileList(source_dir);
    for(File f: fileList)
View Full Code Here


   * @throws IOException
   * @throws ResourceInstantiationException
   */
  public static void opt4(String source_dir, String op_dir, Boolean nercFlag)
  {
    MappingPipeline mp = null;
   
    try {
      mp = new MappingPipeline();
    } catch (MalformedURLException e1) {
      System.err.println("Logic.op4(..): " + e1.getMessage());
    }
   
    MLPipeline ml_p = new MLPipeline();
View Full Code Here

      * @param op_dir
      * @throws Exception
      */
    public void ml(String source_dir, String op_dir, Boolean nercFlag) throws Exception
    {
      MappingPipeline mapping = null;
     
      if(nercFlag)
        mapping = new MappingPipeline();
     
      featureFile = new ArrayList<String>();

      ArrayList<File> fileList = RecurseFolder.getFileList(source_dir);
      for(File f: fileList)
      {
        System.out.print("\r.processing: " + f.getName() + "\r");
        String filename = f.getName().substring(0, f.getName().indexOf("."));
       
        gateDoc = Factory.newDocument(FileOps.getFileContent(f.getAbsolutePath()));
        gateDoc = Pipeline.preProcPipeline(gateDoc);
        gateDoc.setName(f.getName().replace(".txt", ""));
       
        //construct a feature vector for document f
        featureFile.clear();
        Logic.constructFeatureFile(gateDoc, featureFile);
            
       
        for(int i = 0; i < 3; i++)
        {
          String model = "test";
          if (i==1)
            {model = "treatment";}
          else if(i==2)
            {model = "problem";}
         
          String tagged_file = Crf.run("models/"+model + "_model_iobw", featureFile);
          String[] aS = tagged_file.split("\n");   
          for(String s : aS)
          {
            String[] row = s.split("\t");
            String label = row[1];
            int tokenId = Integer.parseInt(row[0].substring(row[0].indexOf(":")+1, row[0].length()));
     
            Annotation aToken = gateDoc.getAnnotations().get("Token").get(tokenId);
            gate.FeatureMap gateMap = aToken.getFeatures();
            gateMap.put("crf_prediction", label + "_" + model);
            aToken.setFeatures(gateMap);
          }
            //post-process:
            //-crf_prediction tags per token to final crf_prediction annotation span across 1 or more tokens [Done]
            //-remove FP & adjust boundaries [rule set not added yet 20.4.13]
          gateDoc = Pipeline.postProcPipeline(gateDoc);
         
          //classification pipeline
          if(nercFlag)
            gateDoc = mapping.run(gateDoc);
        }
        //save to op_dir
        FileOps.saveFile(op_dir + "/" + filename + ".xml", gateDoc.toXml());
      }
    Factory.deleteResource(gateDoc);
View Full Code Here

       * result format: startOffset\tendOffset||text=<Tx identified>
       */
      if(args[0].toLowerCase().contentEquals("--stdio"))
      { 
        MLPipeline p = new MLPipeline();
        MappingPipeline mp = null;
       
        if(nercFlag)
          mp = new MappingPipeline();
       
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String x = null
            while((x = input.readLine()) != null && !x.equals("quit();")) {
              System.out.println(Logic.opt1(x, p, mp, nercFlag));
View Full Code Here

    }

  public void run() {
  
     MLPipeline p = new MLPipeline(); //N.B.
     MappingPipeline mp = null;
    try {
      mp = new MappingPipeline();
    } catch (MalformedURLException e1) {
      System.err.println("SessionHandler.run(): " + e1.getMessage());
    }
    
    try {
View Full Code Here

TOP

Related Classes of classification.MappingPipeline

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.