support -tt

This commit is contained in:
Hieu Hoang 2016-01-06 16:35:24 +00:00
parent 4791e75a6b
commit 4443a34052
4 changed files with 25 additions and 7 deletions

View File

@ -228,15 +228,17 @@ void Scores::CreateFromString(const std::string &str,
void Scores::Debug(std::ostream &out, const System &system) const
{
out << "total=" << m_total;
if (system.nbestSize) {
out << ", ";
BOOST_FOREACH(const FeatureFunction *ff, system.featureFunctions.GetFeatureFunctions()) {
out << ff->GetName() << ":";
out << ff->GetName() << "= ";
for (size_t i = ff->GetStartInd(); i < (ff->GetStartInd() + ff->GetNumScores()); ++i) {
out << m_scores[i] << " ";
}
}
}
out << "= " << m_total;
}
std::ostream& operator<<(std::ostream &out, const Scores &obj)

View File

@ -159,8 +159,23 @@ void Hypothesis::OutputToStream(std::ostream &out) const
out << phrase << " ";
}
if (m_mgr->system.reportSegmentation && m_path->range.GetStartPos() != NOT_FOUND) {
out << "|" << m_path->range.GetStartPos() << "-" << m_path->range.GetEndPos() << "| ";
if (m_path->range.GetStartPos() != NOT_FOUND) {
if (m_mgr->system.reportSegmentation == 1) {
// just report phrase segmentation
out << "|" << m_path->range.GetStartPos() << "-" << m_path->range.GetEndPos() << "| ";
}
else if (m_mgr->system.reportSegmentation == 2) {
// more detailed info about every segment
out << "|";
// phrase segmentation
out << m_path->range.GetStartPos() << "-" << m_path->range.GetEndPos() << ",";
// score breakdown
m_scores->Debug(out, m_mgr->system);
out << "| ";
}
}
}

View File

@ -36,8 +36,9 @@ System::System(const Parameter &paramsArg)
params.SetParameter(cpuAffinityOffset, "cpu-affinity-offset",
0);
params.SetParameter(reportSegmentation, "report-segmentation",
false);
reportSegmentation = (params.GetParam("report-segmentation-enriched")
? 2 : params.GetParam("report-segmentation")
? 1 : 0);
params.SetParameter(outputHypoScore, "output-hypo-score",
false);

View File

@ -55,7 +55,7 @@ public:
bool onlyDistinct;
bool outputHypoScore;
bool reportSegmentation;
int reportSegmentation;
int cpuAffinityOffset;
System(const Parameter &paramsArg);