Package joshua.discriminative.feature_related.feature_function

Examples of joshua.discriminative.feature_related.feature_function.EdgeTblBasedBaselineFF


    //=== baseline feature ====
    //TODO: ????????????????????????????????????????????????????     
    int baselineFeatID = 99;
    //??????????????????????????????????????
   
    EdgeTblBasedBaselineFF baselineFeature = new EdgeTblBasedBaselineFF(baselineFeatID, baselineWeight);
    features.add(baselineFeature);
   

    //=== reranking feature ===
    //TODO: ??????????????
    int ngramStateID = 0;
    int baselineLMOrder = 5;
    int startNgramOrder = 1;
    int endNgramOrder = 2;
    int featID = 100;
    double weight = 1.0;
    //????????
   
    Map<String,Integer> rulesIDTable = null; //TODO??
 
    //TODO
    FeatureFunction rerankFF = DiscriminativeSupport.setupRerankingFeature(featID, weight, symbolTbl, useTMFeat, useLMFeat, useEdgeNgramOnly, useTMTargetFeat,
        JoshuaConfiguration.useMicroTMFeat, JoshuaConfiguration.wordMapFile,
        ngramStateID,
        baselineLMOrder, startNgramOrder, endNgramOrder, featureFile, modelFile, rulesIDTable);
   
    features.add(rerankFF);
   
    //=== reranker using the feature functions
    HGRanker reranker = new HGRanker(features);
   
    BufferedWriter out1best = FileUtilityOld.getWriteFileStream(reranked1bestFile);
   
         
    int topN=3;
    boolean useUniqueNbest =true;
    boolean useTreeNbest = false;
    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);
   
      try{
        kbestExtractor.lazyKBestExtractOnHG(testHG, features, topN, sentID, out1best);
      } catch (IOException e) {
View Full Code Here


        String[] fds = line.split("\\s+");
        if (fds[0].compareTo("vbaseline") == 0 && fds.length == 2) {
          //baseline feature
          double baselineWeight = new Double(fds[1].trim());
         
          FeatureFunction ff =  new EdgeTblBasedBaselineFF(ngramStateID+1+featFunctions.size(), baselineWeight);         
          featFunctions.add(ff);
          logger.info(String.format("Baseline feature wiht weight: " + baselineWeight));       
         
        }else if (fds[0].compareTo("vbaselinecombo") == 0 && fds.length > 2) {
          //baseline combo features: vbaselinecombo list-of-baseline-features (each one should be " pos_id||inter-weight ") weight
View Full Code Here

TOP

Related Classes of joshua.discriminative.feature_related.feature_function.EdgeTblBasedBaselineFF

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.