Examples of readHyperGraph()


Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

      DiskHyperGraph dhg = new DiskHyperGraph(p_symbol, baseline_lm_feat_id, saveModelCosts, null);
      dhg.initRead(f_hypergraphs, f_rule_tbl, null);
      //int total_num_sent = 5;
      for(int sent_id=0; sent_id < total_num_sent; sent_id ++){
        System.out.println("############Process sentence " + sent_id);
        HyperGraph hg = dhg.readHyperGraph();
       
        if(itemSpecific)
          g_con.itemSpecificConfusionExtraction(hg);
        else
          g_con.cellSpecificConfusionExtraction(hg,hg.sentLen);
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

    EntropyOnHGUsingIO ds = new EntropyOnHGUsingIO(1.0);
    DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, ngramStateID, true, null); //have model costs stored
    diskHG.initRead(f_dev_items, f_dev_rules,null);
    for(int sentID=0; sentID < numSents; sentID ++){
      System.out.println("#Process sentence " + sentID);
      HyperGraph testHG = diskHG.readHyperGraph();   
     
      ds.setHyperGraph(testHG);
     
      ds.runInsideOutside();
      ds.printGoalX();
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

    DefaultInsideSemiringParser ds = new EntropyOnHG(1.0);
    DiskHyperGraph dhg_test = new DiskHyperGraph(p_symbol, ngramStateID, true, null); //
    dhg_test.initRead(f_dev_items, f_dev_rules,null);
    for(int sent_id=0; sent_id < num_sents; sent_id ++){
      System.out.println("#Process sentence " + sent_id);
      HyperGraph hg_test = dhg_test.readHyperGraph();   
      ds.setHyperGraph(hg_test);
      ds.insideEstimationOverHG();
      ExpectationSemiring<LogSemiring,ScalarPM> goalSemiring = (ExpectationSemiring<LogSemiring,ScalarPM>) ds.getGoalK();
      //goal_semiring.printInfor();
      goalSemiring.getR().getValue().multiLogNumber(-goalSemiring.getP().getLogValue());//normalize
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

    DefaultSemiringParser ds = new EntropyOnHG(1,0,scale);
    DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, ngramStateID, true, null); //have model costs stored
    diskHG.initRead(f_dev_items, f_dev_rules,null);
    for(int sentID=0; sentID < num_sents; sentID ++){
      System.out.println("#Process sentence " + sentID);
      HyperGraph testHG = diskHG.readHyperGraph();     
      ds.insideEstimationOverHG(testHG);
      ExpectationSemiring goalSemiring = (ExpectationSemiring) ds.getGoalSemiringMember(testHG);
      //goal_semiring.printInfor();
      goalSemiring.normalizeFactors();
      goalSemiring.printInfor();
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

    for(int k=0;k<136; k++){
      for(int sent_id=0; sent_id < num_sents; sent_id ++){
        System.out.println("#Process sentence " + sent_id);
        HyperGraph hg_test;
        if(k==0){ 
          hg_test = diskHG.readHyperGraph();
          hyperGraphs.add(hg_test);
        }else
          hg_test = hyperGraphs.get(sent_id);
        ds.setHyperGraph(hg_test);
        ds.runInsideOutside();
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

    DefaultSemiringParser ds = new HypLenSquareExpectation(1,0,scale);
    DiskHyperGraph dhg_test = new DiskHyperGraph(p_symbol, baseline_lm_feat_id, true, null); //have model costs stored
    dhg_test.initRead(f_dev_items, f_dev_rules,null);
    for(int sent_id=0; sent_id < num_sents; sent_id ++){
      System.out.println("#Process sentence " + sent_id);
      HyperGraph hg_test = dhg_test.readHyperGraph();     
      ds.insideEstimationOverHG(hg_test);
      CompositeSemiring goal_semiring = ds.getGoalSemiringMember(hg_test);
      goal_semiring.normalizeFactors();
      goal_semiring.printInfor();
    }   
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

      System.out.println("############Process sentence " + sent_id);
      start_time = System.currentTimeMillis();
      sent_id++;
      //if(sent_id>10)break;
     
      HyperGraph hg = dhg_read.readHyperGraph();
      if(hg==null)continue;
     
      double orc_bleu=0;
     
      //System.out.println("read disk hyp: " + (System.currentTimeMillis()-start_time));
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

    System.out.println("############Process file  " + testItemsFile);
    DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, ngramStateID, true, null); //have model costs stored
    diskHG.initRead(testItemsFile, testRulesFile,null);     
    for(int sentID=0; sentID < numSents; sentID ++){
      System.out.println("#Process sentence " + sentID);
      HyperGraph testHG = diskHG.readHyperGraph();
     
      List<String> nbest = cruncher.processOneSent(testHG, sentID, true);//produce the disorder nbest
     
      String bestHyp = mbrReranker.processOneSent(nbest, sentID);//nbest: list of unique strings
     
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

    System.out.println("############Process file  " + testItemsFile);
    DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, ngramStateID, true, null); //have model costs stored
    diskHG.initRead(testItemsFile, testRulesFile,null);     
    for(int sentID=0; sentID < numSents; sentID ++){
      System.out.println("#Process sentence " + sentID);
      HyperGraph testHG = diskHG.readHyperGraph();     
      List<String> oneBest = cruncher.processOneSent(testHG, sentID, false);//produce the reranked onebest
      FileUtilityOld.writeLzf(onebestWriter, oneBest.get(0) + "\n");
    }
    FileUtilityOld.closeWriteFile(onebestWriter);       
  }
View Full Code Here

Examples of joshua.decoder.hypergraph.DiskHyperGraph.readHyperGraph()

    DiskHyperGraph dhg_test = new DiskHyperGraph(p_symbol, baseline_lm_feat_id, true, null); //have model costs stored
    dhg_test.initRead(f_test_items, f_test_rules,null);   
    double sumGap = 0;
    for(int sent_id=0; sent_id < num_sents; sent_id ++){
      System.out.println("#Process sentence " + sent_id);
      HyperGraph hg_test = dhg_test.readHyperGraph();     
      double gap = cruncher.processOneSent(hg_test, sent_id, false);//produce the reranked onebest
      sumGap += gap;
    }
    sumGap *= 1.44;
    System.out.println("sum of bits in gap is: " +  sumGap);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.