From 6cbdccb1d9a62b2723b962ba4b6e66f1631e48d3 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Tue, 3 Mar 2015 01:14:07 -0500 Subject: migration to cmake --- decoder/CMakeLists.txt | 179 ++++++++++++++++++++++++++++++++++++++ decoder/Makefile.am | 166 ----------------------------------- decoder/apply_models.h | 6 +- decoder/decoder.h | 4 +- decoder/factored_lexicon_helper.h | 2 +- decoder/ff_csplit.h | 4 +- decoder/ff_klm.cc | 1 - decoder/ff_klm.h | 2 +- decoder/ff_lm.cc | 2 +- decoder/ff_lm.h | 3 +- decoder/ff_ngrams.cc | 8 +- decoder/ff_ngrams.h | 2 +- decoder/ff_spans.h | 1 - decoder/ff_wordalign.cc | 2 - decoder/grammar.h | 2 +- decoder/hg_union.cc | 4 +- decoder/phrasebased_translator.h | 2 +- decoder/scfg_translator.cc | 2 +- decoder/sentence_metadata.h | 6 +- decoder/translator.h | 8 +- decoder/tree_fragment.cc | 4 +- decoder/trule.h | 2 +- 22 files changed, 209 insertions(+), 203 deletions(-) create mode 100644 decoder/CMakeLists.txt delete mode 100644 decoder/Makefile.am (limited to 'decoder') diff --git a/decoder/CMakeLists.txt b/decoder/CMakeLists.txt new file mode 100644 index 00000000..591ab7b3 --- /dev/null +++ b/decoder/CMakeLists.txt @@ -0,0 +1,179 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../klm) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..) + +PROJECT(decoder C CXX) + +find_package(FLEX REQUIRED) + +FLEX_TARGET(RuleLexer rule_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/rule_lexer.cc) + +set(libcdec_SRCS + aligner.h + apply_models.h + bottom_up_parser.h + bottom_up_parser-rs.h + csplit.h + decoder.h + earley_composer.h + factored_lexicon_helper.h + ff.h + ff_basic.h + ff_bleu.h + ff_charset.h + ff_conll.h + ff_const_reorder_common.h + ff_const_reorder.h + ff_context.h + ff_csplit.h + ff_external.h + ff_factory.h + ff_klm.h + ff_lexical.h + ff_lm.h + ff_ngrams.h + ff_parse_match.h + ff_register.h + ff_rules.h + ff_ruleshape.h + ff_sample_fsa.h + ff_soft_syn.h + ff_soft_syntax.h + ff_soft_syntax_mindist.h + ff_source_path.h + ff_source_syntax.h + ff_source_syntax2.h + ff_spans.h + ff_tagger.h + ff_wordalign.h + ff_wordset.h + ffset.h + forest_writer.h + freqdict.h + grammar.h + hg.h + hg_intersect.h + hg_io.h + hg_remove_eps.h + hg_sampler.h + hg_test.h + hg_union.h + incremental.h + inside_outside.h + kbest.h + lattice.h + lexalign.h + lextrans.h + nt_span.h + oracle_bleu.h + phrasebased_translator.h + phrasetable_fst.h + program_options.h + rule_lexer.h + sentence_metadata.h + sentences.h + tagger.h + translator.h + trule.h + viterbi.h + aligner.cc + apply_models.cc + bottom_up_parser.cc + bottom_up_parser-rs.cc + cdec_ff.cc + csplit.cc + decoder.cc + earley_composer.cc + factored_lexicon_helper.cc + ff.cc + ff_basic.cc + ff_bleu.cc + ff_charset.cc + ff_conll.cc + ff_context.cc + ff_const_reorder.cc + ff_csplit.cc + ff_external.cc + ff_factory.cc + ff_klm.cc + ff_lm.cc + ff_ngrams.cc + ff_parse_match.cc + ff_rules.cc + ff_ruleshape.cc + ff_soft_syn.cc + ff_soft_syntax.cc + ff_soft_syntax_mindist.cc + ff_source_path.cc + ff_source_syntax.cc + ff_source_syntax2.cc + ff_spans.cc + ff_tagger.cc + ff_wordalign.cc + ff_wordset.cc + ffset.cc + forest_writer.cc + fst_translator.cc + tree2string_translator.cc + grammar.cc + hg.cc + hg_intersect.cc + hg_io.cc + hg_remove_eps.cc + hg_sampler.cc + hg_union.cc + incremental.cc + lattice.cc + lexalign.cc + lextrans.cc + node_state_hash.h + tree_fragment.cc + tree_fragment.h + maxtrans_blunsom.cc + phrasebased_translator.cc + phrasetable_fst.cc + rescore_translator.cc + ${FLEX_RuleLexer_OUTPUTS} + scfg_translator.cc + tagger.cc + translator.cc + trule.cc + viterbi.cc) + +add_library(libcdec STATIC ${libcdec_SRCS}) + +set(cdec_SRCS cdec.cc) +add_executable(cdec ${cdec_SRCS}) +target_link_libraries(cdec libcdec mteval utils ksearch klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES}) + +set(TEST_SRCS + grammar_test.cc + hg_test.cc + parser_test.cc + t2s_test.cc + trule_test.cc) + +foreach(testSrc ${TEST_SRCS}) + #Extract the filename without an extension (NAME_WE) + get_filename_component(testName ${testSrc} NAME_WE) + + #Add compile target + set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"") + add_executable(${testName} ${testSrc}) + + #link to Boost libraries AND your targets and dependencies + target_link_libraries(${testName} libcdec mteval utils ksearch klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES}) + + #I like to move testing binaries into a testBin directory + set_target_properties(${testName} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + #Finally add it to test execution - + #Notice the WORKING_DIRECTORY and COMMAND + add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endforeach(testSrc) + + + diff --git a/decoder/Makefile.am b/decoder/Makefile.am deleted file mode 100644 index dbec532e..00000000 --- a/decoder/Makefile.am +++ /dev/null @@ -1,166 +0,0 @@ -bin_PROGRAMS = cdec - -noinst_PROGRAMS = \ - trule_test \ - hg_test \ - parser_test \ - t2s_test \ - grammar_test - -TESTS = trule_test parser_test grammar_test hg_test -t2s_test_SOURCES = t2s_test.cc -t2s_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -parser_test_SOURCES = parser_test.cc -parser_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -grammar_test_SOURCES = grammar_test.cc -grammar_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -hg_test_SOURCES = hg_test.cc -hg_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -trule_test_SOURCES = trule_test.cc -trule_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a - -cdec_SOURCES = cdec.cc -cdec_LDFLAGS= -rdynamic $(STATIC_FLAGS) -cdec_LDADD = libcdec.a ../mteval/libmteval.a ../utils/libutils.a ../klm/search/libksearch.a ../klm/lm/libklm.a ../klm/util/libklm_util.a ../klm/util/double-conversion/libklm_util_double.a - -AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/decoder/test_data\" -DBOOST_TEST_DYN_LINK -W -Wno-sign-compare -I$(top_srcdir) -I$(top_srcdir)/mteval -I$(top_srcdir)/utils -I$(top_srcdir)/klm - -rule_lexer.cc: rule_lexer.ll - $(LEX) -s -CF -8 -o$@ $< - -noinst_LIBRARIES = libcdec.a - -EXTRA_DIST = test_data rule_lexer.ll - -libcdec_a_SOURCES = \ - aligner.h \ - apply_models.h \ - bottom_up_parser.h \ - bottom_up_parser-rs.h \ - csplit.h \ - decoder.h \ - earley_composer.h \ - factored_lexicon_helper.h \ - ff.h \ - ff_basic.h \ - ff_bleu.h \ - ff_charset.h \ - ff_conll.h \ - ff_const_reorder_common.h \ - ff_const_reorder.h \ - ff_context.h \ - ff_csplit.h \ - ff_external.h \ - ff_factory.h \ - ff_klm.h \ - ff_lexical.h \ - ff_lm.h \ - ff_ngrams.h \ - ff_parse_match.h \ - ff_register.h \ - ff_rules.h \ - ff_ruleshape.h \ - ff_sample_fsa.h \ - ff_soft_syn.h \ - ff_soft_syntax.h \ - ff_soft_syntax_mindist.h \ - ff_source_path.h \ - ff_source_syntax.h \ - ff_source_syntax2.h \ - ff_spans.h \ - ff_tagger.h \ - ff_wordalign.h \ - ff_wordset.h \ - ffset.h \ - forest_writer.h \ - freqdict.h \ - grammar.h \ - hg.h \ - hg_intersect.h \ - hg_io.h \ - hg_remove_eps.h \ - hg_sampler.h \ - hg_test.h \ - hg_union.h \ - incremental.h \ - inside_outside.h \ - kbest.h \ - lattice.h \ - lexalign.h \ - lextrans.h \ - nt_span.h \ - oracle_bleu.h \ - phrasebased_translator.h \ - phrasetable_fst.h \ - program_options.h \ - rule_lexer.h \ - sentence_metadata.h \ - sentences.h \ - tagger.h \ - translator.h \ - trule.h \ - viterbi.h \ - aligner.cc \ - apply_models.cc \ - bottom_up_parser.cc \ - bottom_up_parser-rs.cc \ - cdec.cc \ - cdec_ff.cc \ - csplit.cc \ - decoder.cc \ - earley_composer.cc \ - factored_lexicon_helper.cc \ - ff.cc \ - ff_basic.cc \ - ff_bleu.cc \ - ff_charset.cc \ - ff_conll.cc \ - ff_context.cc \ - ff_const_reorder.cc \ - ff_csplit.cc \ - ff_external.cc \ - ff_factory.cc \ - ff_klm.cc \ - ff_lm.cc \ - ff_ngrams.cc \ - ff_parse_match.cc \ - ff_rules.cc \ - ff_ruleshape.cc \ - ff_soft_syn.cc \ - ff_soft_syntax.cc \ - ff_soft_syntax_mindist.cc \ - ff_source_path.cc \ - ff_source_syntax.cc \ - ff_source_syntax2.cc \ - ff_spans.cc \ - ff_tagger.cc \ - ff_wordalign.cc \ - ff_wordset.cc \ - ffset.cc \ - forest_writer.cc \ - fst_translator.cc \ - tree2string_translator.cc \ - grammar.cc \ - hg.cc \ - hg_intersect.cc \ - hg_io.cc \ - hg_remove_eps.cc \ - hg_sampler.cc \ - hg_union.cc \ - incremental.cc \ - lattice.cc \ - lexalign.cc \ - lextrans.cc \ - node_state_hash.h \ - tree_fragment.cc \ - tree_fragment.h \ - maxtrans_blunsom.cc \ - phrasebased_translator.cc \ - phrasetable_fst.cc \ - rescore_translator.cc \ - rule_lexer.cc \ - scfg_translator.cc \ - tagger.cc \ - translator.cc \ - trule.cc \ - viterbi.cc diff --git a/decoder/apply_models.h b/decoder/apply_models.h index f03c973a..bfb37df1 100644 --- a/decoder/apply_models.h +++ b/decoder/apply_models.h @@ -3,9 +3,9 @@ #include -struct ModelSet; -struct Hypergraph; -struct SentenceMetadata; +class ModelSet; +class Hypergraph; +class SentenceMetadata; struct exhaustive_t {}; diff --git a/decoder/decoder.h b/decoder/decoder.h index a545206b..6250d1eb 100644 --- a/decoder/decoder.h +++ b/decoder/decoder.h @@ -25,7 +25,7 @@ private: class SentenceMetadata; class Hypergraph; -class DecoderImpl; +struct DecoderImpl; class DecoderObserver { public: @@ -38,7 +38,7 @@ class DecoderObserver { virtual void NotifyDecodingComplete(const SentenceMetadata& smeta); }; -class Grammar; // TODO once the decoder interface is cleaned up, +struct Grammar; // TODO once the decoder interface is cleaned up, // this should be somewhere else class Decoder { public: diff --git a/decoder/factored_lexicon_helper.h b/decoder/factored_lexicon_helper.h index 460bdebb..8e89f473 100644 --- a/decoder/factored_lexicon_helper.h +++ b/decoder/factored_lexicon_helper.h @@ -7,7 +7,7 @@ #include #include "tdict.h" -struct SentenceMetadata; +class SentenceMetadata; // when computing features, it can be advantageous to: // 1) back off to less specific forms (e.g., less highly inflected forms, POS tags, etc) diff --git a/decoder/ff_csplit.h b/decoder/ff_csplit.h index 227f2a14..1721ed38 100644 --- a/decoder/ff_csplit.h +++ b/decoder/ff_csplit.h @@ -6,7 +6,7 @@ #include "ff.h" #include "klm/lm/model.hh" -class BasicCSplitFeaturesImpl; +struct BasicCSplitFeaturesImpl; class BasicCSplitFeatures : public FeatureFunction { public: BasicCSplitFeatures(const std::string& param); @@ -22,7 +22,7 @@ class BasicCSplitFeatures : public FeatureFunction { boost::shared_ptr pimpl_; }; -template class ReverseCharLMCSplitFeatureImpl; +template struct ReverseCharLMCSplitFeatureImpl; class ReverseCharLMCSplitFeature : public FeatureFunction { public: ReverseCharLMCSplitFeature(const std::string& param); diff --git a/decoder/ff_klm.cc b/decoder/ff_klm.cc index 339a10c3..d395fb47 100644 --- a/decoder/ff_klm.cc +++ b/decoder/ff_klm.cc @@ -347,7 +347,6 @@ void KLanguageModel::TraversalFeaturesImpl(const SentenceMetadata& /* sme SparseVector* features, SparseVector* /*estimated_features*/, void* state) const { - double est = 0; double oovs = 0; double emit = 0; features->set_value(fid_, pimpl_->LookupWords(*edge.rule_, ant_states, &oovs, &emit, state)); diff --git a/decoder/ff_klm.h b/decoder/ff_klm.h index c8350623..7a0b92ec 100644 --- a/decoder/ff_klm.h +++ b/decoder/ff_klm.h @@ -7,7 +7,7 @@ #include "ff_factory.h" #include "ff.h" -template struct KLanguageModelImpl; +template class KLanguageModelImpl; // the supported template types are instantiated explicitly // in ff_klm.cc. diff --git a/decoder/ff_lm.cc b/decoder/ff_lm.cc index bc51076f..0780b266 100644 --- a/decoder/ff_lm.cc +++ b/decoder/ff_lm.cc @@ -211,7 +211,7 @@ class LanguageModelImpl : public LanguageModelInterface { // may be shorter than actual null-terminated length. context must be null terminated. len is just to save effort for subclasses that don't support contextID virtual int ContextSize(WordID const* context,int len) { - unsigned ret; + unsigned ret = 0; //ngram_.contextID((VocabIndex*)context,ret); return ret; } diff --git a/decoder/ff_lm.h b/decoder/ff_lm.h index 83a2e186..740cc492 100644 --- a/decoder/ff_lm.h +++ b/decoder/ff_lm.h @@ -44,8 +44,7 @@ class LanguageModelInterface { } }; -struct LanguageModelImpl; - +class LanguageModelImpl; class LanguageModel : public FeatureFunction { public: // param = "filename.lm [-o n]" diff --git a/decoder/ff_ngrams.cc b/decoder/ff_ngrams.cc index 38e1a60a..a45bd27d 100644 --- a/decoder/ff_ngrams.cc +++ b/decoder/ff_ngrams.cc @@ -33,11 +33,12 @@ struct State { } const State& operator=(const State& other) { memcpy(state, other.state, sizeof(state)); + return *this; } explicit State(const State& other, unsigned order, WordID extend) { - char om1 = order - 1; + unsigned om1 = order - 1; if (!om1) { memset(state, 0, sizeof(state)); return; } - for (char i = 1; i < om1; ++i) state[i - 1]= other.state[i]; + for (unsigned i = 1; i < om1; ++i) state[i - 1]= other.state[i]; state[om1 - 1] = extend; } const WordID& operator[](size_t i) const { return state[i]; } @@ -249,8 +250,6 @@ class NgramDetectorImpl { public: void LookupWords(const TRule& rule, const vector& ant_states, SparseVector* feats, SparseVector* est_feats, void* remnant) { - double sum = 0.0; - double est_sum = 0.0; int num_scored = 0; int num_estimated = 0; bool saw_eos = false; @@ -264,7 +263,6 @@ class NgramDetectorImpl { int unscored_ant_len = UnscoredSize(astate); for (int k = 0; k < unscored_ant_len; ++k) { const WordID cur_word = IthUnscoredWord(k, astate); - const bool is_oov = (cur_word == 0); SparseVector p; if (cur_word == kSOS_) { state = BeginSentenceState(); diff --git a/decoder/ff_ngrams.h b/decoder/ff_ngrams.h index 5dea9a7d..05b25974 100644 --- a/decoder/ff_ngrams.h +++ b/decoder/ff_ngrams.h @@ -7,7 +7,7 @@ #include "ff.h" -struct NgramDetectorImpl; +class NgramDetectorImpl; class NgramDetector : public FeatureFunction { public: // param = "filename.lm [-o ] [-U ] [-B ] [-T ] [-4 <4-gram-prefix>] [-5 <5-gram-prefix>] [-S ] diff --git a/decoder/ff_spans.h b/decoder/ff_spans.h index e2475491..d0036340 100644 --- a/decoder/ff_spans.h +++ b/decoder/ff_spans.h @@ -62,7 +62,6 @@ class CMR2008ReorderingFeatures : public FeatureFunction { // collapsed feature values bool use_collapsed_features_; - int fid_reorder_; std::pair uncoditioned_vals_; std::vector > fvals_; }; diff --git a/decoder/ff_wordalign.cc b/decoder/ff_wordalign.cc index dcb80110..5d4c80c7 100644 --- a/decoder/ff_wordalign.cc +++ b/decoder/ff_wordalign.cc @@ -28,8 +28,6 @@ namespace std { using std::tr1::unordered_map; } #include "tdict.h" // Blunsom hack #include "filelib.h" // Blunsom hack -static const int MAX_SENTENCE_SIZE = 100; - static const int kNULL_i = 255; // -1 as an unsigned char using namespace std; diff --git a/decoder/grammar.h b/decoder/grammar.h index add1a235..37c7276d 100644 --- a/decoder/grammar.h +++ b/decoder/grammar.h @@ -61,7 +61,7 @@ struct Grammar { typedef boost::shared_ptr GrammarPtr; -class TGImpl; +struct TGImpl; struct TextGrammar : public Grammar { TextGrammar(); explicit TextGrammar(const std::string& file); diff --git a/decoder/hg_union.cc b/decoder/hg_union.cc index a659b6bc..da9f2624 100644 --- a/decoder/hg_union.cc +++ b/decoder/hg_union.cc @@ -64,9 +64,9 @@ void Union(const Hypergraph& in, Hypergraph* out) { double n_created = 0; for (const auto& in_node : in.nodes_) { HG::Node& out_node = out->nodes_[h2n[in_node.node_hash]]; - for (const auto oeid : out_node.in_edges_) { + //for (const auto oeid : out_node.in_edges_) { // TODO hash currently existing edges for quick check for duplication - } + //} for (const auto ieid : in_node.in_edges_) { const HG::Edge& in_edge = in.edges_[ieid]; // TODO: replace slow N^2 check with hashing diff --git a/decoder/phrasebased_translator.h b/decoder/phrasebased_translator.h index 10790d0d..85dc0a26 100644 --- a/decoder/phrasebased_translator.h +++ b/decoder/phrasebased_translator.h @@ -3,7 +3,7 @@ #include "translator.h" -class PhraseBasedTranslatorImpl; +struct PhraseBasedTranslatorImpl; class PhraseBasedTranslator : public Translator { public: PhraseBasedTranslator(const boost::program_options::variables_map& conf); diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc index 538f82ec..9831a3c3 100644 --- a/decoder/scfg_translator.cc +++ b/decoder/scfg_translator.cc @@ -62,7 +62,7 @@ PassThroughGrammar::PassThroughGrammar(const Lattice& input, const string& cat, for (int i = 0; i < input.size(); ++i) { const vector& alts = input[i]; for (int k = 0; k < alts.size(); ++k) { - const int j = alts[k].dist2next + i; + // const int j = alts[k].dist2next + i; const string& src = TD::Convert(alts[k].label); if (ss.count(alts[k].label) == 0) { if (num_pt_features > 0) { diff --git a/decoder/sentence_metadata.h b/decoder/sentence_metadata.h index e13c2ca5..27fcac38 100644 --- a/decoder/sentence_metadata.h +++ b/decoder/sentence_metadata.h @@ -7,8 +7,8 @@ #include "lattice.h" #include "tree_fragment.h" -struct DocScorer; // deprecated, will be removed -struct Score; // deprecated, will be removed +class DocScorer; // deprecated, will be removed +class Score; // deprecated, will be removed namespace cdec { enum InputType { kSEQUENCE, kTREE, kLATTICE, kFOREST, kUNKNOWN }; @@ -17,7 +17,7 @@ class TreeFragment; class SentenceMetadata { public: - friend class DecoderImpl; + friend struct DecoderImpl; SentenceMetadata(int id, const Lattice& ref) : sent_id_(id), src_len_(-1), diff --git a/decoder/translator.h b/decoder/translator.h index 096cf191..37070cda 100644 --- a/decoder/translator.h +++ b/decoder/translator.h @@ -54,7 +54,7 @@ class Translator { State state_; }; -class SCFGTranslatorImpl; +struct SCFGTranslatorImpl; class SCFGTranslator : public Translator { public: SCFGTranslator(const boost::program_options::variables_map& conf); @@ -72,7 +72,7 @@ class SCFGTranslator : public Translator { boost::shared_ptr pimpl_; }; -class FSTTranslatorImpl; +struct FSTTranslatorImpl; class FSTTranslator : public Translator { public: FSTTranslator(const boost::program_options::variables_map& conf); @@ -85,7 +85,7 @@ class FSTTranslator : public Translator { boost::shared_ptr pimpl_; }; -class RescoreTranslatorImpl; +struct RescoreTranslatorImpl; class RescoreTranslator : public Translator { public: RescoreTranslator(const boost::program_options::variables_map& conf); @@ -98,7 +98,7 @@ class RescoreTranslator : public Translator { boost::shared_ptr pimpl_; }; -class Tree2StringTranslatorImpl; +struct Tree2StringTranslatorImpl; class Tree2StringTranslator : public Translator { public: Tree2StringTranslator(const boost::program_options::variables_map& conf, diff --git a/decoder/tree_fragment.cc b/decoder/tree_fragment.cc index 5f717c5b..ff406adf 100644 --- a/decoder/tree_fragment.cc +++ b/decoder/tree_fragment.cc @@ -79,7 +79,7 @@ void TreeFragment::ParseRec(const StringPiece& tree, bool afs, unsigned cp, unsi cerr << "Expected ( at " << cp << endl; abort(); } - const unsigned i = symp; + // const unsigned i = symp; vector rhs; // w | 0 = terminal, w | NT_BIT, index | FRONTIER_BIT ++cp; while(tree[cp] == ' ') { ++cp; } @@ -119,7 +119,7 @@ void TreeFragment::ParseRec(const StringPiece& tree, bool afs, unsigned cp, unsi } } } // continuent has completed, cp is at ), build node - const unsigned j = symp; // span from (i,j) + // const unsigned j = symp; // span from (i,j) // add an internal non-terminal symbol const unsigned nt = TD::Convert(tree.substr(nt_start, nt_end - nt_start).as_string()) | RHS_BIT; nodes[np] = TreeFragmentProduction(nt, rhs); diff --git a/decoder/trule.h b/decoder/trule.h index 7af46747..dda85cef 100644 --- a/decoder/trule.h +++ b/decoder/trule.h @@ -16,7 +16,7 @@ class TRule; typedef boost::shared_ptr TRulePtr; -namespace cdec { struct TreeFragment; } +namespace cdec { class TreeFragment; } struct AlignmentPoint { AlignmentPoint() : s_(), t_() {} -- cgit v1.2.3