Examples of HyperGraph


Examples of joshua.decoder.hypergraph.HyperGraph

    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.HyperGraph

    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.HyperGraph

    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.HyperGraph

    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){ 
          hg_test = diskHG.readHyperGraph();
          hyperGraphs.add(hg_test);
        }else
          hg_test = hyperGraphs.get(sent_id);
View Full Code Here

Examples of joshua.decoder.hypergraph.HyperGraph

    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.HyperGraph

      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));
      time_on_reading += System.currentTimeMillis()-start_time;
      start_time = System.currentTimeMillis();
     
      if(orc_extract_nbest){
        Object[] res = orc_extractor.oracleExtractOnNbest(kbestExtractor, hg, topN, do_ngram_clip_nbest, ref_sent);
        String orc_sent = (String) res[0];
        orc_bleu = (Double) res[1];
        orc_out.write(orc_sent+"\n");
      }else{       
        HyperGraph hg_oracle = orc_extractor.oracleExtractOnHG(hg, hg.sentLen, lm_order, ref_sent);
        oracleKbestExtractor.lazyKBestExtractOnHG(hg_oracle, null, topKOracles, hg.sentID, orc_out);
        orc_bleu = hg_oracle.goalNode.bestHyperedge.bestDerivationLogP;
        time_on_orc_extract += System.currentTimeMillis()-start_time;
        //System.out.println("num_virtual_items: " + orc_extractor.numRefinedNodes + " num_virtual_dts: " + orc_extractor.numRefinedEdges);
        //System.out.println("oracle extract: " + (System.currentTimeMillis()-start_time));
View Full Code Here

Examples of joshua.decoder.hypergraph.HyperGraph

    if (logger.isLoggable(Level.FINER))
      logger.finer("after seed, time: "
        + (System.currentTimeMillis() - start) / 1000);
   
    //=========================parsing
    HyperGraph p_hyper_graph = chart.expand();
    if (logger.isLoggable(Level.FINER))
      logger.finer("after expand, time: "  + (System.currentTimeMillis() - start) / 1000);   
   
    postProcessHypergraph(p_hyper_graph, sentenceID);
  }
View Full Code Here

Examples of joshua.decoder.hypergraph.HyperGraph

    refNgramsTbl.clear();
    getNgrams(refNgramsTbl, bleuOrder, refWords, false);
   
    equiv.setupPrefixAndSurfixTbl(refNgramsTbl);
   
    HyperGraph res= splitHG(hg);
   
    return res;
  }
View Full Code Here

Examples of joshua.decoder.hypergraph.HyperGraph

    refSentLen = BLEU.computeEffectiveLen(refLens, useShortestRef);
    refNgramsTbl =  BLEU.computeMaxRefCountTbl(listRefNgramTbl);
   
    equiv.setupPrefixAndSurfixTbl(refNgramsTbl);
   
    HyperGraph res= splitHG(hg);
   
    return res;
  }
View Full Code Here

Examples of joshua.decoder.hypergraph.HyperGraph

   
    splitNode(hg.goalNode);
    HGNode newGoal = getVirtualGoalItem(hg, splitRefinedNodesTbl);
    printInfo();
   
    HyperGraph newHG = new HyperGraph(newGoal, numRefinedNodes, numRefinedEdges, hg.sentID, hg.sentLen);
    return newHG;
 
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.