#ifndef _TARGET_PHRASE_EXTRACTOR_H_ #define _TARGET_PHRASE_EXTRACTOR_H_ #include #include #include using namespace std; namespace extractor { typedef vector> PhraseAlignment; class Alignment; class DataArray; class Phrase; class PhraseBuilder; class RuleExtractorHelper; class Vocabulary; class TargetPhraseExtractor { public: TargetPhraseExtractor(shared_ptr target_data_array, shared_ptr alignment, shared_ptr phrase_builder, shared_ptr helper, shared_ptr vocabulary, int max_rule_span, bool require_tight_phrases); virtual ~TargetPhraseExtractor(); // Finds all the target phrases that can extracted from a span in the // target sentence (matching the given set of target phrase gaps). virtual vector> ExtractPhrases( const vector>& target_gaps, const vector& target_low, int target_phrase_low, int target_phrase_high, const unordered_map& source_indexes, int sentence_id) const; protected: TargetPhraseExtractor(); private: // Computes the cartesian product over the sets of possible target phrase // chunks. void GeneratePhrases( vector>& target_phrases, const vector>& ranges, int index, vector& subpatterns, const vector& target_gap_order, int target_phrase_low, int target_phrase_high, const unordered_map& source_indexes, int sentence_id) const; shared_ptr target_data_array; shared_ptr alignment; shared_ptr phrase_builder; shared_ptr helper; shared_ptr vocabulary; int max_rule_span; bool require_tight_phrases; }; } // namespace extractor #endif