From dd59cf9271ecaee1a54a76e61b53e6ecb825339b Mon Sep 17 00:00:00 2001 From: graehl Date: Tue, 6 Jul 2010 18:11:22 +0000 Subject: warnings git-svn-id: https://ws10smt.googlecode.com/svn/trunk@157 ec762483-ff6d-05da-a07a-a48fb63a330f --- extools/featurize_grammar.cc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/extools/featurize_grammar.cc b/extools/featurize_grammar.cc index 1ca20a4b..4c9821ec 100644 --- a/extools/featurize_grammar.cc +++ b/extools/featurize_grammar.cc @@ -41,7 +41,7 @@ void InitCommandLine(int argc, char** argv, po::variables_map* conf) { po::options_description clo("Command line options"); po::options_description dcmdline_options; dcmdline_options.add(opts); - + po::store(parse_command_line(argc, argv, dcmdline_options), *conf); po::notify(*conf); @@ -139,9 +139,9 @@ void ParseLine(const char* buf, vector* cur_key, ID2RuleStatistics* coun void LexTranslationTable::createTTable(const char* buf){ AnnotatedParallelSentence sent; sent.ParseInputLine(buf); - + //iterate over the alignment to compute aligned words - + for(int i =0;i (sent.f[i], NULL_)]; @@ -187,16 +187,16 @@ static bool IsZero(float f) { return (f > 0.999 && f < 1.001); } struct FeatureExtractor { // create any keys necessary - virtual void ObserveFilteredRule(const WordID lhs, - const vector& src, - const vector& trg) {} + virtual void ObserveFilteredRule(const WordID /* lhs */, + const vector& /* src */, + const vector& /* trg */) {} // compute statistics over keys, the same lhs-src-trg tuple may be seen // more than once - virtual void ObserveUnfilteredRule(const WordID lhs, - const vector& src, - const vector& trg, - const RuleStatistics& info) {} + virtual void ObserveUnfilteredRule(const WordID /* lhs */, + const vector& /* src */, + const vector& /* trg */, + const RuleStatistics& /* info */) {} // compute features, a unique lhs-src-trg tuple will be seen exactly once virtual void ExtractFeatures(const WordID lhs, @@ -241,7 +241,7 @@ struct LexProbExtractor : public FeatureExtractor { while(alignment) { alignment.getline(buf, MAX_LINE_LENGTH); if (buf[0] == 0) continue; - table.createTTable(buf); + table.createTTable(buf); } delete[] buf; } @@ -271,7 +271,7 @@ struct LexProbExtractor : public FeatureExtractor { if ( table.total_english[trg[ita->second]] !=0 ) e2f = (float) temp / table.total_english[trg[ita->second]]; if (DEBUG) printf (" %d %E %E\n", temp, f2e, e2f); - + //local counts to keep track of which things haven't been aligned, to later compute their null alignment if (foreign_aligned.count(src[ita->first])) { foreign_aligned[ src[ita->first] ].first++; @@ -279,7 +279,7 @@ struct LexProbExtractor : public FeatureExtractor { } else { foreign_aligned[ src[ita->first] ] = pair (1,e2f); } - + if (english_aligned.count( trg[ ita->second] )) { english_aligned[ trg[ ita->second] ].first++; english_aligned[ trg[ ita->second] ].second += f2e; @@ -294,8 +294,8 @@ struct LexProbExtractor : public FeatureExtractor { //compute lexical weight P(F|E) and include unaligned foreign words for(int i=0;i temp_lex_prob = foreign_aligned[src[i]]; final_lex_e2f *= temp_lex_prob.second / temp_lex_prob.first; @@ -305,14 +305,14 @@ struct LexProbExtractor : public FeatureExtractor { int temp_count = table.word_translation[pair (src[i],NULL_)]; float temp_e2f = (float) temp_count / table.total_english[NULL_]; final_lex_e2f *= temp_e2f; - } + } } //compute P(E|F) unaligned english words for(int j=0; j< trg.size(); j++) { if (!table.total_english.count(trg[j])) continue; - + if (english_aligned.count(trg[j])) { pair temp_lex_prob = english_aligned[trg[j]]; @@ -338,7 +338,6 @@ int main(int argc, char** argv){ ifstream alignment (conf["aligned_corpus"].as().c_str()); ReadFile fg1(conf["filtered_grammar"].as()); - istream& fs1 = *fg1.stream(); // TODO make this list configurable vector > extractors; @@ -355,6 +354,7 @@ int main(int argc, char** argv){ vector src; #if 0 + istream& fs1 = *fg1.stream(); int line = 0; while(fs1) { fs1.getline(buf, MAX_LINE_LENGTH); -- cgit v1.2.3