Package joshua.discriminative.syntax_reorder.HashtableBasedHieroGrammarScorer

Examples of joshua.discriminative.syntax_reorder.HashtableBasedHieroGrammarScorer.Rule


      int[] phrase = (int[])l_init_phrases.get(t);
      for(int n_nts=0; n_nts<=max_num_non_terminals; n_nts++){
        if(bins[phrase[0]][phrase[1]+1][n_nts]!=null){
          for(int t2=0; t2<bins[phrase[0]][phrase[1]+1][n_nts].size(); t2++){
            ArrayList item = (ArrayList) bins[phrase[0]][phrase[1]+1][n_nts].get(t2);
            Rule rule = makeAndScoreRule(align, phrase, item);
            if(rule!=null){
              local_results.add(rule);
            }
          }
        }
      }     
      //distribute the count, normalization
      for(int k=0; k < local_results.size(); k++){
        Rule rl = (Rule)local_results.get(k);
        for(int f=0; f<rl.feat_scores.length; f++)
          rl.feat_scores[f] /= local_results.size();
        rl.print_info(symbolTable);
      }
      l_phrases_and_rules.addAll(local_results);
      //System.out.println("local size " + local_results.size() + " all size " + l_phrases_and_rules.size());
    }
    System.out.println("num of rules and phrases is "  + l_phrases_and_rules.size());
View Full Code Here


        k++;
      }
    }
   
    //create rule
    Rule rl = new Rule(phrase[4], rule_fwords , rule_ewords);
   
    //add alignment infor
    if(keep_alignment_infor==true){
      ArrayList align_info =new ArrayList();
      for(int i=0; i<fpos.length; i++)
View Full Code Here

TOP

Related Classes of joshua.discriminative.syntax_reorder.HashtableBasedHieroGrammarScorer.Rule

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.