Package joshua.decoder.hypergraph

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


    int baseline_lm_feat_id =0;
    int num_sents =5;
    double scale=1.0;
    DefaultSemiringParser ds = new HypLenExpectation(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 goalSemiring = ds.getGoalSemiringMember(hg_test);
View Full Code Here


        f_confusion_grammar="C:\\Users\\zli\\Documents\\cellspecific.confusion.grammar";
      */
     
      ConfusionExtractor g_con = new ConfusionExtractor(p_symbol);
      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();
       
View Full Code Here

   
    double sumEntropy = 0;
   
    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);
View Full Code Here

   
    double sumEntropy = 0;
   
    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();
View Full Code Here

   
    double sumEntropy = 0;
   
    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);
View Full Code Here

   
    ArrayList<HyperGraph> hyperGraphs = new  ArrayList<HyperGraph>();;
   
    HypLenSquareExpectation ds = new HypLenSquareExpectation(scale);
    DiskHyperGraph diskHG = new DiskHyperGraph(p_symbol, baseline_lm_feat_id, true, null); //have model costs stored
    diskHG.initRead(f_dev_items, f_dev_rules,null);
    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){ 
View Full Code Here

    int num_sents =5;
   
    double scale=1.0;
    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);
View Full Code Here

    BufferedReader t_reader_ref = FileUtility.getReadFileStream(f_ref_files);
   
    DiskHyperGraph dhg_read  = new DiskHyperGraph(p_symbolTable, baseline_lm_feat_id, saveModelScores, null);
   
 
    dhg_read.initRead(f_hypergraphs, f_rule_tbl, null);
   
    KBestExtractor oracleKbestExtractor = new KBestExtractor(p_symbolTable, extract_unique_nbest, false, false, true,  false, true);//extract kbest oracles
    KBestExtractor rerankOracleKbestExtractor = new KBestExtractor(p_symbolTable, extract_unique_nbest, false, false, false,  false, true);//extract kbest oracles
    int topKOracles= 500;//TODO
    //OracleExtractionOnHGV2 orc_extractor = new OracleExtractionOnHGV2(p_symbolTable, baseline_lm_feat_id);
View Full Code Here

 
    BufferedWriter onebestWriter =  FileUtilityOld.getWriteFileStream(onebestFile)
   
    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
View Full Code Here

 
    BufferedWriter onebestWriter =  FileUtilityOld.getWriteFileStream(onebestFile)
   
    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");
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.