Examples of initRead()


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

    long time_on_reading = 0;
    long time_on_orc_extract = 0;
    BufferedReader t_reader_ref = FileUtility.getReadFileStream(f_ref_files);
    DiskHyperGraph dhg_read  = new DiskHyperGraph(p_symbolTable, baseline_lm_feat_id, true, null);
 
    dhg_read.initRead(f_hypergraphs, f_rule_tbl, null);
   
    OracleExtractionHG orc_extractor = new OracleExtractionHG(p_symbolTable, baseline_lm_feat_id);
    String ref_sent= null;
    long start_time = System.currentTimeMillis();
    int sent_id=0;
View Full Code Here

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

      BufferedWriter out1best = FileUtilityOld.getWriteFileStream(reranked1bestFile);
     
      RescorerHGSimple reranker = new RescorerHGSimple();
     
      DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, ngramStateID, saveModelCosts, null);
      diskHG.initRead(testNodesFile, testRulesFile, null);
      for(int sent_id=0; sent_id < numSent; sent_id ++){
        System.out.println("#Process sentence " + sent_id);
        HyperGraph testHG = diskHG.readHyperGraph();
        ((TableBasedBaselineFT) baselineFeature).setBaselineScoreTbl( reranker.collectTransitionLogPs(testHG) );
        HyperGraph rerankedOnebestHG = reranker.rerankHGAndGet1best(testHG, modelTbl, restrictedFeatureSet, featTemplates, isAvgModel);
View Full Code Here

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

    boolean addCombinedCost = true
    KBestExtractor kbestExtractor = new KBestExtractor(symbolTbl, useUniqueNbest, useTreeNbest, false, addCombinedCost, false, true);
   
   
    DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, ngramStateID, saveModelCosts, null);
    diskHG.initRead(testNodesFile, testRulesFile, null);
    for(int sentID=0; sentID < numSent; sentID ++){
      System.out.println("#Process sentence " + sentID);
      HyperGraph testHG = diskHG.readHyperGraph();
      baselineFeature.collectTransitionLogPs(testHG);
      reranker.rankHG(testHG);
View Full Code Here

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

    HashMap<String, Double> tbl_feats = new HashMap<String, Double>();
       
    for(int fid=0; fid < testItemsFiles.size(); fid++){
      System.out.println("############Process file id " + fid);
      DiskHyperGraph dhg_train = new DiskHyperGraph(p_symbol, ngramStateID, saveModelScore, null);
      dhg_train.initRead((String)testItemsFiles.get(fid), (String)testRulesFiles.get(fid),null);   
      int total_num_sent = new Integer((String)l_num_sents.get(fid));
      for(int sent_id=0; sent_id < total_num_sent; sent_id ++){
        System.out.println("############Process sentence " + sent_id);
        HyperGraph hg_train = dhg_train.readHyperGraph();       
        FeatureExtractionHG.featureExtractionOnHG(hg_train, tbl_feats, null, featureTemplates);
View Full Code Here

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

    //#####begin to do training
    int sentID=0;   
    for(int fid=0; fid < l_file_train_items.size(); fid++){
      System.out.println("############Process file id " + fid);
      DiskHyperGraph diskHG = new DiskHyperGraph(p_symbol, ngramStateID, saveModelCosts, null);
      diskHG.initRead(l_file_train_items.get(fid), l_file_train_rules.get(fid),tbl_sent_selected);
       
      int total_num_sent = new Integer((String)l_num_sents.get(fid));
      for(int sent_id=0; sent_id < total_num_sent; sent_id ++){
        System.out.println("#Process sentence " + sentID);
        HyperGraph hg = diskHG.readHyperGraph();
View Full Code Here

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

  public void  decodingTestSet(String testItemsFile, String testRulesFile, int numSents, String nbestFile) {

    BufferedWriter nbestWriter =  FileUtilityOld.getWriteFileStream(nbestFile)
    System.out.println("############Process file  " + testItemsFile);
    DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, VariationalDecoderConfiguration.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();
      /*if(use_constituent_decoding)
 
View Full Code Here

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

    for(int loop_id=0; loop_id<max_loop; loop_id++){
      System.out.println("###################################Loop " + loop_id);
      for(int fid=0; fid < l_file_train_items.size(); fid++){
        System.out.println("############Process file id " + fid);
        DiskHyperGraph dhg_train = new DiskHyperGraph(symbolTbl, ngramStateID, saveModelCosts, null);
        dhg_train.initRead((String)l_file_train_items.get(fid), (String)l_file_train_rules.get(fid),tbl_sent_selected);
        DiskHyperGraph dhg_orc =null;
        BufferedReader t_reader_orc =null;
        if(l_file_orc_rules!=null){
          dhg_orc = new DiskHyperGraph(symbolTbl, ngramStateID, saveModelCosts, null);
          dhg_orc.initRead((String)l_file_orc_items.get(fid), (String)l_file_orc_rules.get(fid), tbl_sent_selected);
View Full Code Here

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

        dhg_train.initRead((String)l_file_train_items.get(fid), (String)l_file_train_rules.get(fid),tbl_sent_selected);
        DiskHyperGraph dhg_orc =null;
        BufferedReader t_reader_orc =null;
        if(l_file_orc_rules!=null){
          dhg_orc = new DiskHyperGraph(symbolTbl, ngramStateID, saveModelCosts, null);
          dhg_orc.initRead((String)l_file_orc_items.get(fid), (String)l_file_orc_rules.get(fid), tbl_sent_selected);
        }else{
          t_reader_orc = FileUtilityOld.getReadFileStream((String)l_file_orc_items.get(fid),"UTF-8");
        }
         
        int total_num_sent = new Integer((String)l_num_sents.get(fid));
View Full Code Here

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

    DefaultSemiringParser parserEntropyP = new CrossEntropyOnHG(1, 0, scale, pFeatFunctions, pFeatFunctions);
    DefaultSemiringParser parserEntropyQ = new CrossEntropyOnHG(1, 0, scale, qFeatFunctions, qFeatFunctions);
    DefaultSemiringParser parserCrossentropyPQ = new CrossEntropyOnHG(1, 0, scale, pFeatFunctions, qFeatFunctions);
   
    DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, ngramStateID, true, null); //have model costs stored
    diskHG.initRead(testItemsFile, testRulesFile, null);   
    for(int sent_id=0; sent_id < num_sents; sent_id ++){
      System.out.println("#Process sentence " + sent_id);
      HyperGraph testHG = diskHG.readHyperGraph();
     
      //################setup the model: including estimation of variational model
View Full Code Here

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

    //#### process test set
    BufferedWriter t_writer_nbest =  FileUtilityOld.getWriteFileStream(f_nbest)
    BufferedWriter t_writer_1best =  FileUtilityOld.getWriteFileStream(f_1best);
    System.out.println("############Process file  " + f_test_items);
    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);
     
    for(int sent_id=0; sent_id < num_sents; sent_id ++){
      System.out.println("#Process sentence " + sent_id);
      HyperGraph hg_test = dhg_test.readHyperGraph();     
      //if(sent_id==1)System.exit(1);
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.