Package joshua.discriminative.feature_related.feature_template

Examples of joshua.discriminative.feature_related.feature_template.FeatureTemplate


     
      //======== setup feature templates list
      List<FeatureTemplate> featTemplates =  new ArrayList<FeatureTemplate>()
     
      String baselineName = "baseline_lzf";//TODO
      FeatureTemplate baselineFeature = new TableBasedBaselineFT(baselineName, baselineScale);
      featTemplates.add(baselineFeature)
     
      if(useTMFeat==true){
        FeatureTemplate ft = new TMFT(symbolTbl, useIntegerString, useRuleIDName);
        featTemplates.add(ft);
      }
       
      int baselineLMOrder = 5;//TODO??????????????????
      if(useLMFeat==true){ 
        FeatureTemplate ft = new NgramFT(symbolTbl, false, ngramStateID, baselineLMOrder, 1, 2);//TODO: unigram and bi gram
        featTemplates.add(ft);
      }else if(useEdgeNgramOnly){//exclusive with use_lm_feat
        FeatureTemplate ft = new EdgeBigramFT(symbolTbl, ngramStateID, baselineLMOrder, useIntegerString);
        featTemplates.add(ft);
      }   
      System.out.println("templates are: " + featTemplates);
     
      //============= restricted feature set : normally this is not used as the model itself is a restriction
View Full Code Here


      ){
   
    List<FeatureTemplate> featTemplates =  new ArrayList<FeatureTemplate>()
   
      if(useTMFeat==true){
      FeatureTemplate ft = new TMFT(symbolTbl, useIntegerString, useRuleIDName);
      featTemplates.add(ft);
    }
     
    if(useTMTargetFeat==true){
      FeatureTemplate ft = new TargetTMFT(symbolTbl, useIntegerString);
      featTemplates.add(ft);
    }
     
    if(useMicroTMFeat){     
      int startOrder =2;//TODO
      int endOrder =2;//TODO     
      MicroRuleFT microRuleFeatureTemplate = new MicroRuleFT(useRuleIDName, startOrder, endOrder, wordMapFile);
      microRuleFeatureTemplate.setupTbl(rulesStringToIDTable, restrictedFeatureSet);     
          featTemplates.add(microRuleFeatureTemplate);
   
     
    if(useLMFeat==true){ 
      FeatureTemplate ft = new NgramFT(symbolTbl, useIntegerString, ngramStateID, baselineLMOrder, startNgramOrder, endNgramOrder);
      featTemplates.add(ft);
    }else if(useEdgeNgramOnly){//exclusive with use_lm_feat
      FeatureTemplate ft = new EdgeBigramFT(symbolTbl, ngramStateID, baselineLMOrder, useIntegerString);
      featTemplates.add(ft);
    }   
    logger.info("templates are: " + featTemplates);
       
   
View Full Code Here

   
    boolean useIntegerString = false;
    boolean useRuleIDName = false;
   
    if(use_tm_feat==true){
      FeatureTemplate ft = new TMFT(p_symbol, useIntegerString, useRuleIDName);
      featureTemplates.add(ft);
    }
   
    if(use_lm_feat==true){
      FeatureTemplate ft = new NgramFT(p_symbol, false, ngramStateID, baseline_lm_order, 1 ,2);//TODO: unigram and bi gram
      featureTemplates.add(ft);
    }else if(use_edge_ngram_only){//exclusive with use_lm_feat
      FeatureTemplate ft = new EdgeBigramFT(p_symbol, ngramStateID, baseline_lm_order, useIntegerString);
      featureTemplates.add(ft);
    }
   
    if(use_joint_tm_lm_feature){
      //TODO: not implement
View Full Code Here

   
    boolean useIntegerString = false;
    boolean useRuleIDName = false;
   
    if(useTMFeat==true){
      FeatureTemplate ft = new TMFT(p_symbol, useIntegerString, useRuleIDName);
      featTemplates.add(ft);
    }
   
    int baseline_lm_order = 3;//TODO
    if(useLMFeat==true){
      FeatureTemplate ft = new NgramFT(p_symbol, false, ngramStateID, baseline_lm_order,1,2);//TODO: unigram and bi gram
      featTemplates.add(ft);
    }else if(useEdgeNgramOnly){//exclusive with use_lm_feat
      FeatureTemplate ft = new EdgeBigramFT(p_symbol, ngramStateID, baseline_lm_order, useIntegerString);
      featTemplates.add(ft);
    }   
   
    System.out.println("feature template are " + featTemplates.toString());
   
View Full Code Here

   
    //##setup feature templates list
    ArrayList<FeatureTemplate> l_feat_templates =  new ArrayList<FeatureTemplate>();
    ArrayList<FeatureTemplate> l_feat_templates_nobaseline =  new ArrayList<FeatureTemplate>();
   
    FeatureTemplate ft_bs = new BaselineFT(baselineFeatName, true);//baseline feature
    l_feat_templates.add(ft_bs);   
   
   
    boolean useIntegerString = false;
    boolean useRuleIDName = false;
   
    if(use_tm_feat==true){
      FeatureTemplate ft = new TMFT(symbolTbl, useIntegerString, useRuleIDName);
      l_feat_templates.add(ft);
      l_feat_templates_nobaseline.add(ft);
    }
   
  
   
    int baseline_lm_order = 3;//TODO
    if(use_lm_feat==true){
      FeatureTemplate ft = new NgramFT(symbolTbl, false, ngramStateID, baseline_lm_order,1,2);//TODO: unigram and bi gram
      l_feat_templates.add(ft);
      l_feat_templates_nobaseline.add(ft);
    }else if(use_edge_ngram_only){//exclusive with use_lm_feat
      FeatureTemplate ft = new EdgeBigramFT(symbolTbl, ngramStateID, baseline_lm_order, useIntegerString);
      l_feat_templates.add(ft);
      l_feat_templates_nobaseline.add(ft);
    }
   
    if(use_joint_tm_lm_feature){
View Full Code Here

          if(vlmOrder> baselineLMOrder){
            System.out.println("varatioanl_ngram_order is greater than baseline_lm_order; must be wrong");
            System.exit(1);
          }
          double weight = new Double(fds[2].trim());         
          FeatureTemplate ft = new NgramFT(symbolTbl, true , ngramStateID, baselineLMOrder, vlmOrder, vlmOrder);
          FeatureTemplateBasedFF ff =  new FeatureTemplateBasedFF(ngramStateID+1+featFunctions.size(), weight, ft);
         
          VariationalNgramApproximator rmodel = new VariationalNgramApproximator(symbolTbl, ft, 1.0, vlmOrder);
          featFunctions.add(ff);
          approximatorMap.put(rmodel, ff);         
View Full Code Here

  private void setupFeatureTemplates(){
   
    this.featTemplates = new ArrayList<FeatureTemplate>();
   
    if(MRConfig.useBaseline){
      FeatureTemplate ft = new BaselineFT(MRConfig.baselineFeatureName, true);
      featTemplates.add(ft);
    }
   
    if(MRConfig.useIndividualBaselines){
      for(int id : MRConfig.baselineFeatIDsToTune){       
        String featName = MRConfig.individualBSFeatNamePrefix +id;       
        FeatureTemplate ft = new IndividualBaselineFT(featName, id, true);
        featTemplates.add(ft)
      }
    }
   
    if(MRConfig.useSparseFeature){
     
      if(MRConfig.useMicroTMFeat){ 
        //FeatureTemplate ft = new TMFT(symbolTbl, useIntegerString, MRConfig.useRuleIDName);
        this.microRuleFeatureTemplate = new MicroRuleFT(MRConfig.useRuleIDName, MRConfig.startTargetNgramOrder, MRConfig.endTargetNgramOrder, MRConfig.wordMapFile);
        featTemplates.add(microRuleFeatureTemplate);
      }
     
      if(MRConfig.useTMFeat){
        FeatureTemplate ft = new TMFT(symbolTbl, useIntegerString, MRConfig.useRuleIDName);       
        featTemplates.add(ft);
      }
     
      if(MRConfig.useTMTargetFeat){     
        FeatureTemplate ft = new TargetTMFT(symbolTbl, useIntegerString);
        featTemplates.add(ft);   
     
       
      if(MRConfig.useLMFeat){
        FeatureTemplate ft = new NgramFT(symbolTbl, useIntegerString, MRConfig.ngramStateID,
                        MRConfig.baselineLMOrder, MRConfig.startNgramOrder, MRConfig.endNgramOrder);
        featTemplates.add(ft);
      }
    } 
   
View Full Code Here

TOP

Related Classes of joshua.discriminative.feature_related.feature_template.FeatureTemplate

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.