diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2014-09-29 20:58:20 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2014-09-29 20:58:20 +0400 |
commit | 55db902f5f37c2b58eb77d1a98c57d93434b22d9 (patch) | |
tree | 6bd043a2348b734c7d4011dd1d694b8a75cc5cc9 | |
parent | d60571341d3fd04b2af1d8687359e940eb8cb74b (diff) |
move IOWrapper into moses/
-rw-r--r-- | contrib/other-builds/moses-chart-cmd/.project | 10 | ||||
-rw-r--r-- | contrib/other-builds/moses-cmd/.project | 10 | ||||
-rw-r--r-- | contrib/other-builds/moses/.project | 20 | ||||
-rw-r--r-- | moses-chart-cmd/Jamfile | 2 | ||||
-rw-r--r-- | moses-chart-cmd/Main.cpp | 22 | ||||
-rw-r--r-- | moses-chart-cmd/Main.h | 4 | ||||
-rw-r--r-- | moses-cmd/Jamfile | 2 | ||||
-rw-r--r-- | moses-cmd/LatticeMBRGrid.cpp | 2 | ||||
-rw-r--r-- | moses-cmd/Main.cpp | 2 | ||||
-rw-r--r-- | moses/IOWrapper.cpp (renamed from moses-cmd/IOWrapper.cpp) | 0 | ||||
-rw-r--r-- | moses/IOWrapper.h (renamed from moses-cmd/IOWrapper.h) | 0 | ||||
-rw-r--r-- | moses/IOWrapperChart.cpp (renamed from moses-chart-cmd/IOWrapper.cpp) | 76 | ||||
-rw-r--r-- | moses/IOWrapperChart.h (renamed from moses-chart-cmd/IOWrapper.h) | 6 |
13 files changed, 78 insertions, 78 deletions
diff --git a/contrib/other-builds/moses-chart-cmd/.project b/contrib/other-builds/moses-chart-cmd/.project index e59b8b8f7..16eb28b21 100644 --- a/contrib/other-builds/moses-chart-cmd/.project +++ b/contrib/other-builds/moses-chart-cmd/.project @@ -87,16 +87,6 @@ </natures> <linkedResources> <link> - <name>IOWrapper.cpp</name> - <type>1</type> - <locationURI>PARENT-3-PROJECT_LOC/moses-chart-cmd/IOWrapper.cpp</locationURI> - </link> - <link> - <name>IOWrapper.h</name> - <type>1</type> - <locationURI>PARENT-3-PROJECT_LOC/moses-chart-cmd/IOWrapper.h</locationURI> - </link> - <link> <name>Jamfile</name> <type>1</type> <locationURI>PARENT-3-PROJECT_LOC/moses-chart-cmd/Jamfile</locationURI> diff --git a/contrib/other-builds/moses-cmd/.project b/contrib/other-builds/moses-cmd/.project index 52e2accfd..432c15321 100644 --- a/contrib/other-builds/moses-cmd/.project +++ b/contrib/other-builds/moses-cmd/.project @@ -87,16 +87,6 @@ </natures> <linkedResources> <link> - <name>IOWrapper.cpp</name> - <type>1</type> - <locationURI>PARENT-3-PROJECT_LOC/moses-cmd/IOWrapper.cpp</locationURI> - </link> - <link> - <name>IOWrapper.h</name> - <type>1</type> - <locationURI>PARENT-3-PROJECT_LOC/moses-cmd/IOWrapper.h</locationURI> - </link> - <link> <name>Jamfile</name> <type>1</type> <locationURI>PARENT-3-PROJECT_LOC/moses-cmd/Jamfile</locationURI> diff --git a/contrib/other-builds/moses/.project b/contrib/other-builds/moses/.project index 2c8699956..879819182 100644 --- a/contrib/other-builds/moses/.project +++ b/contrib/other-builds/moses/.project @@ -432,6 +432,26 @@ <locationURI>PARENT-3-PROJECT_LOC/moses/HypothesisStackNormal.h</locationURI> </link> <link> + <name>IOWrapper.cpp</name> + <type>1</type> + <locationURI>PARENT-3-PROJECT_LOC/moses/IOWrapper.cpp</locationURI> + </link> + <link> + <name>IOWrapper.h</name> + <type>1</type> + <locationURI>PARENT-3-PROJECT_LOC/moses/IOWrapper.h</locationURI> + </link> + <link> + <name>IOWrapperChart.cpp</name> + <type>1</type> + <locationURI>PARENT-3-PROJECT_LOC/moses/IOWrapperChart.cpp</locationURI> + </link> + <link> + <name>IOWrapperChart.h</name> + <type>1</type> + <locationURI>PARENT-3-PROJECT_LOC/moses/IOWrapperChart.h</locationURI> + </link> + <link> <name>Incremental.cpp</name> <type>1</type> <locationURI>PARENT-3-PROJECT_LOC/moses/Incremental.cpp</locationURI> diff --git a/moses-chart-cmd/Jamfile b/moses-chart-cmd/Jamfile index 47a1bf885..fe84871c7 100644 --- a/moses-chart-cmd/Jamfile +++ b/moses-chart-cmd/Jamfile @@ -1,2 +1,2 @@ -exe moses_chart : Main.cpp mbr.cpp IOWrapper.cpp ../moses//moses $(TOP)//boost_iostreams ..//boost_filesystem ..//z ; +exe moses_chart : Main.cpp mbr.cpp ../moses//moses $(TOP)//boost_iostreams ..//boost_filesystem ..//z ; diff --git a/moses-chart-cmd/Main.cpp b/moses-chart-cmd/Main.cpp index f5f053ada..fcfb0b9b4 100644 --- a/moses-chart-cmd/Main.cpp +++ b/moses-chart-cmd/Main.cpp @@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "Main.h" #include "moses/TranslationAnalysis.h" #include "mbr.h" -#include "IOWrapper.h" +#include "IOWrapperChart.h" #include "moses/FactorCollection.h" #include "moses/HypergraphOutput.h" @@ -81,7 +81,7 @@ void fix(std::ostream& stream, size_t size) class TranslationTask : public Task { public: - TranslationTask(InputType *source, IOWrapper &ioWrapper, + TranslationTask(InputType *source, IOWrapperChart &ioWrapper, boost::shared_ptr<HypergraphOutput<ChartManager> > hypergraphOutput) : m_source(source) , m_ioWrapper(ioWrapper) @@ -195,11 +195,11 @@ private: TranslationTask &operator=(const TranslationTask &); InputType *m_source; - IOWrapper &m_ioWrapper; + IOWrapperChart &m_ioWrapper; boost::shared_ptr<HypergraphOutput<ChartManager> > m_hypergraphOutput; }; -bool ReadInput(IOWrapper &ioWrapper, InputTypeEnum inputType, InputType*& source) +bool ReadInput(IOWrapperChart &ioWrapper, InputTypeEnum inputType, InputType*& source) { delete source; switch(inputType) { @@ -268,8 +268,8 @@ int main(int argc, char* argv[]) TRACE_ERR(endl); } - IOWrapper::FixPrecision(cout); - IOWrapper::FixPrecision(cerr); + IOWrapperChart::FixPrecision(cout); + IOWrapperChart::FixPrecision(cerr); // load data structures Parameter parameter; @@ -289,7 +289,7 @@ int main(int argc, char* argv[]) UTIL_THROW_IF2(!staticData.IsChart(), "Must be SCFG model"); // set up read/writing class - IOWrapper *ioWrapper = GetIOWrapper(staticData); + IOWrapperChart *ioWrapper = GetIOWrapper(staticData); // check on weights const ScoreComponentCollection& weights = staticData.GetAllWeights(); @@ -354,9 +354,9 @@ int main(int argc, char* argv[]) #endif } -IOWrapper *GetIOWrapper(const StaticData &staticData) +IOWrapperChart *GetIOWrapper(const StaticData &staticData) { - IOWrapper *ioWrapper; + IOWrapperChart *ioWrapper; const std::vector<FactorType> &inputFactorOrder = staticData.GetInputFactorOrder() ,&outputFactorOrder = staticData.GetOutputFactorOrder(); FactorMask inputFactorUsed(inputFactorOrder); @@ -366,13 +366,13 @@ IOWrapper *GetIOWrapper(const StaticData &staticData) VERBOSE(2,"IO from File" << endl); string filePath = staticData.GetParam("input-file")[0]; - ioWrapper = new IOWrapper(inputFactorOrder, outputFactorOrder, inputFactorUsed + ioWrapper = new IOWrapperChart(inputFactorOrder, outputFactorOrder, inputFactorUsed , staticData.GetNBestSize() , staticData.GetNBestFilePath() , filePath); } else { VERBOSE(1,"IO from STDOUT/STDIN" << endl); - ioWrapper = new IOWrapper(inputFactorOrder, outputFactorOrder, inputFactorUsed + ioWrapper = new IOWrapperChart(inputFactorOrder, outputFactorOrder, inputFactorUsed , staticData.GetNBestSize() , staticData.GetNBestFilePath()); } diff --git a/moses-chart-cmd/Main.h b/moses-chart-cmd/Main.h index 319e3889c..c57321f04 100644 --- a/moses-chart-cmd/Main.h +++ b/moses-chart-cmd/Main.h @@ -38,8 +38,8 @@ POSSIBILITY OF SUCH DAMAGE. namespace MosesChartCmd { -class IOWrapper; +class IOWrapperChart; } int main(int argc, char* argv[]); -MosesChartCmd::IOWrapper *GetIOWrapper(const Moses::StaticData &staticData); +MosesChartCmd::IOWrapperChart *GetIOWrapper(const Moses::StaticData &staticData); diff --git a/moses-cmd/Jamfile b/moses-cmd/Jamfile index 8d54e0515..4869d729f 100644 --- a/moses-cmd/Jamfile +++ b/moses-cmd/Jamfile @@ -1,4 +1,4 @@ -alias deps : IOWrapper.cpp mbr.cpp ..//z ..//boost_iostreams ..//boost_filesystem ../moses//moses ; +alias deps : mbr.cpp ..//z ..//boost_iostreams ..//boost_filesystem ../moses//moses ; exe moses : Main.cpp deps ; exe lmbrgrid : LatticeMBRGrid.cpp deps ; diff --git a/moses-cmd/LatticeMBRGrid.cpp b/moses-cmd/LatticeMBRGrid.cpp index 904275339..3573d0697 100644 --- a/moses-cmd/LatticeMBRGrid.cpp +++ b/moses-cmd/LatticeMBRGrid.cpp @@ -46,7 +46,7 @@ POSSIBILITY OF SUCH DAMAGE. #include <stdexcept> #include <set> -#include "IOWrapper.h" +#include "moses/IOWrapper.h" #include "moses/LatticeMBR.h" #include "moses/Manager.h" #include "moses/StaticData.h" diff --git a/moses-cmd/Main.cpp b/moses-cmd/Main.cpp index 713ded2e3..0af4603cb 100644 --- a/moses-cmd/Main.cpp +++ b/moses-cmd/Main.cpp @@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #endif #include "moses/TranslationAnalysis.h" -#include "IOWrapper.h" +#include "moses/IOWrapper.h" #include "mbr.h" #include "moses/Hypothesis.h" diff --git a/moses-cmd/IOWrapper.cpp b/moses/IOWrapper.cpp index 1483e0472..1483e0472 100644 --- a/moses-cmd/IOWrapper.cpp +++ b/moses/IOWrapper.cpp diff --git a/moses-cmd/IOWrapper.h b/moses/IOWrapper.h index ed2537986..ed2537986 100644 --- a/moses-cmd/IOWrapper.h +++ b/moses/IOWrapper.h diff --git a/moses-chart-cmd/IOWrapper.cpp b/moses/IOWrapperChart.cpp index 7f50fe246..144088c9e 100644 --- a/moses-chart-cmd/IOWrapper.cpp +++ b/moses/IOWrapperChart.cpp @@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #include <iostream> #include <boost/algorithm/string.hpp> -#include "IOWrapper.h" +#include "IOWrapperChart.h" #include "moses/TypeDef.h" #include "moses/Util.h" #include "moses/WordsRange.h" @@ -57,7 +57,7 @@ using namespace Moses; namespace MosesChartCmd { -IOWrapper::IOWrapper(const std::vector<FactorType> &inputFactorOrder +IOWrapperChart::IOWrapperChart(const std::vector<FactorType> &inputFactorOrder , const std::vector<FactorType> &outputFactorOrder , const FactorMask &inputFactorUsed , size_t nBestSize @@ -142,7 +142,7 @@ IOWrapper::IOWrapper(const std::vector<FactorType> &inputFactorOrder } } -IOWrapper::~IOWrapper() +IOWrapperChart::~IOWrapperChart() { if (!m_inputFilePath.empty()) { delete m_inputStream; @@ -161,12 +161,12 @@ IOWrapper::~IOWrapper() delete m_unknownsCollector; } -void IOWrapper::ResetTranslationId() +void IOWrapperChart::ResetTranslationId() { m_translationId = StaticData::Instance().GetStartTranslationId(); } -InputType*IOWrapper::GetInput(InputType* inputType) +InputType*IOWrapperChart::GetInput(InputType* inputType) { if(inputType->Read(*m_inputStream, m_inputFactorOrder)) { if (long x = inputType->GetTranslationId()) { @@ -227,7 +227,7 @@ void OutputSurface(std::ostream &out, const ChartHypothesis *hypo, const std::ve } } -void IOWrapper::Backtrack(const ChartHypothesis *hypo) +void IOWrapperChart::Backtrack(const ChartHypothesis *hypo) { const vector<const ChartHypothesis*> &prevHypos = hypo->GetPrevHypos(); @@ -240,7 +240,7 @@ void IOWrapper::Backtrack(const ChartHypothesis *hypo) } } -void IOWrapper::OutputBestHypo(const std::vector<const Factor*>& mbrBestHypo, long /*translationId*/) +void IOWrapperChart::OutputBestHypo(const std::vector<const Factor*>& mbrBestHypo, long /*translationId*/) { for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) { const Factor *factor = mbrBestHypo[i]; @@ -272,7 +272,7 @@ void OutputInput(std::ostream& os, const ChartHypothesis* hypo) // Given a hypothesis and sentence, reconstructs the 'application context' -- // the source RHS symbols of the SCFG rule that was applied, plus their spans. -void IOWrapper::ReconstructApplicationContext(const ChartHypothesis &hypo, +void IOWrapperChart::ReconstructApplicationContext(const ChartHypothesis &hypo, const Sentence &sentence, ApplicationContext &context) { @@ -302,7 +302,7 @@ void IOWrapper::ReconstructApplicationContext(const ChartHypothesis &hypo, // Given a hypothesis and sentence, reconstructs the 'application context' -- // the source RHS symbols of the SCFG rule that was applied, plus their spans. -void IOWrapper::ReconstructApplicationContext(const search::Applied *applied, +void IOWrapperChart::ReconstructApplicationContext(const search::Applied *applied, const Sentence &sentence, ApplicationContext &context) { @@ -335,7 +335,7 @@ void IOWrapper::ReconstructApplicationContext(const search::Applied *applied, // output format is a bit odd (reverse order and double spacing between symbols) // but there are scripts and tools that expect the output of -T to look like // that. -void IOWrapper::WriteApplicationContext(std::ostream &out, +void IOWrapperChart::WriteApplicationContext(std::ostream &out, const ApplicationContext &context) { assert(!context.empty()); @@ -349,7 +349,7 @@ void IOWrapper::WriteApplicationContext(std::ostream &out, } } -void IOWrapper::OutputTranslationOption(std::ostream &out, ApplicationContext &applicationContext, const ChartHypothesis *hypo, const Sentence &sentence, long translationId) +void IOWrapperChart::OutputTranslationOption(std::ostream &out, ApplicationContext &applicationContext, const ChartHypothesis *hypo, const Sentence &sentence, long translationId) { ReconstructApplicationContext(*hypo, sentence, applicationContext); out << "Trans Opt " << translationId @@ -361,7 +361,7 @@ void IOWrapper::OutputTranslationOption(std::ostream &out, ApplicationContext &a << " " << hypo->GetTotalScore() << hypo->GetScoreBreakdown(); } -void IOWrapper::OutputTranslationOption(std::ostream &out, ApplicationContext &applicationContext, const search::Applied *applied, const Sentence &sentence, long translationId) +void IOWrapperChart::OutputTranslationOption(std::ostream &out, ApplicationContext &applicationContext, const search::Applied *applied, const Sentence &sentence, long translationId) { ReconstructApplicationContext(applied, sentence, applicationContext); const TargetPhrase &phrase = *static_cast<const TargetPhrase*>(applied->GetNote().vp); @@ -375,7 +375,7 @@ void IOWrapper::OutputTranslationOption(std::ostream &out, ApplicationContext &a } -void IOWrapper::OutputTranslationOptions(std::ostream &out, ApplicationContext &applicationContext, const ChartHypothesis *hypo, const Sentence &sentence, long translationId) +void IOWrapperChart::OutputTranslationOptions(std::ostream &out, ApplicationContext &applicationContext, const ChartHypothesis *hypo, const Sentence &sentence, long translationId) { if (hypo != NULL) { OutputTranslationOption(out, applicationContext, hypo, sentence, translationId); @@ -392,7 +392,7 @@ void IOWrapper::OutputTranslationOptions(std::ostream &out, ApplicationContext & } -void IOWrapper::OutputTranslationOptions(std::ostream &out, ApplicationContext &applicationContext, const search::Applied *applied, const Sentence &sentence, long translationId) +void IOWrapperChart::OutputTranslationOptions(std::ostream &out, ApplicationContext &applicationContext, const search::Applied *applied, const Sentence &sentence, long translationId) { if (applied != NULL) { OutputTranslationOption(out, applicationContext, applied, sentence, translationId); @@ -406,7 +406,7 @@ void IOWrapper::OutputTranslationOptions(std::ostream &out, ApplicationContext & } } -void IOWrapper::OutputTreeFragmentsTranslationOptions(std::ostream &out, ApplicationContext &applicationContext, const ChartHypothesis *hypo, const Sentence &sentence, long translationId) +void IOWrapperChart::OutputTreeFragmentsTranslationOptions(std::ostream &out, ApplicationContext &applicationContext, const ChartHypothesis *hypo, const Sentence &sentence, long translationId) { if (hypo != NULL) { @@ -432,7 +432,7 @@ void IOWrapper::OutputTreeFragmentsTranslationOptions(std::ostream &out, Applica } } -void IOWrapper::OutputTreeFragmentsTranslationOptions(std::ostream &out, ApplicationContext &applicationContext, const search::Applied *applied, const Sentence &sentence, long translationId) +void IOWrapperChart::OutputTreeFragmentsTranslationOptions(std::ostream &out, ApplicationContext &applicationContext, const search::Applied *applied, const Sentence &sentence, long translationId) { if (applied != NULL) { @@ -456,7 +456,7 @@ void IOWrapper::OutputTreeFragmentsTranslationOptions(std::ostream &out, Applica } } -void IOWrapper::OutputDetailedTranslationReport( +void IOWrapperChart::OutputDetailedTranslationReport( const ChartHypothesis *hypo, const Sentence &sentence, long translationId) @@ -473,7 +473,7 @@ void IOWrapper::OutputDetailedTranslationReport( m_detailOutputCollector->Write(translationId, out.str()); } -void IOWrapper::OutputDetailedTranslationReport( +void IOWrapperChart::OutputDetailedTranslationReport( const search::Applied *applied, const Sentence &sentence, long translationId) @@ -490,7 +490,7 @@ void IOWrapper::OutputDetailedTranslationReport( m_detailOutputCollector->Write(translationId, out.str()); } -void IOWrapper::OutputDetailedTreeFragmentsTranslationReport( +void IOWrapperChart::OutputDetailedTreeFragmentsTranslationReport( const ChartHypothesis *hypo, const Sentence &sentence, long translationId) @@ -522,7 +522,7 @@ void IOWrapper::OutputDetailedTreeFragmentsTranslationReport( } -void IOWrapper::OutputDetailedTreeFragmentsTranslationReport( +void IOWrapperChart::OutputDetailedTreeFragmentsTranslationReport( const search::Applied *applied, const Sentence &sentence, long translationId) @@ -545,7 +545,7 @@ void IOWrapper::OutputDetailedTreeFragmentsTranslationReport( } //DIMw -void IOWrapper::OutputDetailedAllTranslationReport( +void IOWrapperChart::OutputDetailedAllTranslationReport( const std::vector<boost::shared_ptr<Moses::ChartKBestExtractor::Derivation> > &nBestList, const ChartManager &manager, const Sentence &sentence, @@ -578,12 +578,12 @@ void IOWrapper::OutputDetailedAllTranslationReport( m_detailAllOutputCollector->Write(translationId, out.str()); } -void IOWrapper::OutputBestHypo(const ChartHypothesis *hypo, long translationId) +void IOWrapperChart::OutputBestHypo(const ChartHypothesis *hypo, long translationId) { if (!m_singleBestOutputCollector) return; std::ostringstream out; - IOWrapper::FixPrecision(out); + IOWrapperChart::FixPrecision(out); if (hypo != NULL) { VERBOSE(1,"BEST TRANSLATION: " << *hypo << endl); VERBOSE(3,"Best path: "); @@ -622,11 +622,11 @@ void IOWrapper::OutputBestHypo(const ChartHypothesis *hypo, long translationId) m_singleBestOutputCollector->Write(translationId, out.str()); } -void IOWrapper::OutputBestHypo(search::Applied applied, long translationId) +void IOWrapperChart::OutputBestHypo(search::Applied applied, long translationId) { if (!m_singleBestOutputCollector) return; std::ostringstream out; - IOWrapper::FixPrecision(out); + IOWrapperChart::FixPrecision(out); if (StaticData::Instance().GetOutputHypoScore()) { out << applied.GetScore() << ' '; } @@ -644,7 +644,7 @@ void IOWrapper::OutputBestHypo(search::Applied applied, long translationId) VERBOSE(1,"BEST TRANSLATION: " << outPhrase << "[total=" << applied.GetScore() << "]" << endl); } -void IOWrapper::OutputBestNone(long translationId) +void IOWrapperChart::OutputBestNone(long translationId) { if (!m_singleBestOutputCollector) return; if (StaticData::Instance().GetOutputHypoScore()) { @@ -654,7 +654,7 @@ void IOWrapper::OutputBestNone(long translationId) } } -void IOWrapper::OutputAllFeatureScores(const ScoreComponentCollection &features, std::ostream &out) +void IOWrapperChart::OutputAllFeatureScores(const ScoreComponentCollection &features, std::ostream &out) { std::string lastName = ""; const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); @@ -674,7 +674,7 @@ void IOWrapper::OutputAllFeatureScores(const ScoreComponentCollection &features, } } // namespace -void IOWrapper::OutputFeatureScores( std::ostream& out, const ScoreComponentCollection &features, const FeatureFunction *ff, std::string &lastName ) +void IOWrapperChart::OutputFeatureScores( std::ostream& out, const ScoreComponentCollection &features, const FeatureFunction *ff, std::string &lastName ) { const StaticData &staticData = StaticData::Instance(); bool labeledOutput = staticData.IsLabeledNBestList(); @@ -698,7 +698,7 @@ void IOWrapper::OutputFeatureScores( std::ostream& out, const ScoreComponentColl } } -void IOWrapper::OutputNBestList(const ChartKBestExtractor::KBestVec &nBestList, +void IOWrapperChart::OutputNBestList(const ChartKBestExtractor::KBestVec &nBestList, long translationId) { std::ostringstream out; @@ -706,7 +706,7 @@ void IOWrapper::OutputNBestList(const ChartKBestExtractor::KBestVec &nBestList, if (m_nBestOutputCollector->OutputIsCout()) { // Set precision only if we're writing the n-best list to cout. This is to // preserve existing behaviour, but should probably be done either way. - IOWrapper::FixPrecision(out); + IOWrapperChart::FixPrecision(out); } bool includeWordAlignment = @@ -758,12 +758,12 @@ void IOWrapper::OutputNBestList(const ChartKBestExtractor::KBestVec &nBestList, m_nBestOutputCollector->Write(translationId, out.str()); } -void IOWrapper::OutputNBestList(const std::vector<search::Applied> &nbest, long translationId) +void IOWrapperChart::OutputNBestList(const std::vector<search::Applied> &nbest, long translationId) { std::ostringstream out; // wtf? copied from the original OutputNBestList if (m_nBestOutputCollector->OutputIsCout()) { - IOWrapper::FixPrecision(out); + IOWrapperChart::FixPrecision(out); } Phrase outputPhrase; ScoreComponentCollection features; @@ -786,7 +786,7 @@ void IOWrapper::OutputNBestList(const std::vector<search::Applied> &nbest, long m_nBestOutputCollector->Write(translationId, out.str()); } -void IOWrapper::FixPrecision(std::ostream &stream, size_t size) +void IOWrapperChart::FixPrecision(std::ostream &stream, size_t size) { stream.setf(std::ios::fixed); stream.precision(size); @@ -817,7 +817,7 @@ size_t CalcSourceSize(const Moses::ChartHypothesis *hypo) return ret; } -size_t IOWrapper::OutputAlignmentNBest( +size_t IOWrapperChart::OutputAlignmentNBest( Alignments &retAlign, const Moses::ChartKBestExtractor::Derivation &derivation, size_t startTarget) @@ -896,7 +896,7 @@ size_t IOWrapper::OutputAlignmentNBest( return totalTargetSize; } -void IOWrapper::OutputAlignment(size_t translationId , const Moses::ChartHypothesis *hypo) +void IOWrapperChart::OutputAlignment(size_t translationId , const Moses::ChartHypothesis *hypo) { ostringstream out; @@ -916,7 +916,7 @@ void IOWrapper::OutputAlignment(size_t translationId , const Moses::ChartHypothe m_alignmentInfoCollector->Write(translationId, out.str()); } -void IOWrapper::OutputUnknowns(const std::vector<Moses::Phrase*> &unknowns, +void IOWrapperChart::OutputUnknowns(const std::vector<Moses::Phrase*> &unknowns, long translationId) { std::ostringstream out; @@ -927,7 +927,7 @@ void IOWrapper::OutputUnknowns(const std::vector<Moses::Phrase*> &unknowns, m_unknownsCollector->Write(translationId, out.str()); } -size_t IOWrapper::OutputAlignment(Alignments &retAlign, const Moses::ChartHypothesis *hypo, size_t startTarget) +size_t IOWrapperChart::OutputAlignment(Alignments &retAlign, const Moses::ChartHypothesis *hypo, size_t startTarget) { size_t totalTargetSize = 0; size_t startSource = hypo->GetCurrSourceRange().GetStartPos(); @@ -1001,7 +1001,7 @@ size_t IOWrapper::OutputAlignment(Alignments &retAlign, const Moses::ChartHypoth return totalTargetSize; } -void IOWrapper::OutputAlignment(vector< set<size_t> > &retAlignmentsS2T, const AlignmentInfo &ai) +void IOWrapperChart::OutputAlignment(vector< set<size_t> > &retAlignmentsS2T, const AlignmentInfo &ai) { typedef std::vector< const std::pair<size_t,size_t>* > AlignVec; AlignVec alignments = ai.GetSortedAlignments(); diff --git a/moses-chart-cmd/IOWrapper.h b/moses/IOWrapperChart.h index 974353190..26f54a8c5 100644 --- a/moses-chart-cmd/IOWrapper.h +++ b/moses/IOWrapperChart.h @@ -57,7 +57,7 @@ namespace MosesChartCmd /** Helper class that holds misc variables to write data out to command line. */ -class IOWrapper +class IOWrapperChart { protected: typedef std::vector<std::pair<Moses::Word, Moses::WordsRange> > ApplicationContext; @@ -113,13 +113,13 @@ protected: , std::string &lastName ); public: - IOWrapper(const std::vector<Moses::FactorType> &inputFactorOrder + IOWrapperChart(const std::vector<Moses::FactorType> &inputFactorOrder , const std::vector<Moses::FactorType> &outputFactorOrder , const Moses::FactorMask &inputFactorUsed , size_t nBestSize , const std::string &nBestFilePath , const std::string &inputFilePath=""); - ~IOWrapper(); + ~IOWrapperChart(); Moses::InputType* GetInput(Moses::InputType *inputType); void OutputBestHypo(const Moses::ChartHypothesis *hypo, long translationId); |