mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
redo property API
This commit is contained in:
parent
ae149b0190
commit
dea105f663
@ -56,6 +56,7 @@
|
||||
<listOptionValue builtIn="false" value="lm"/>
|
||||
<listOptionValue builtIn="false" value="util"/>
|
||||
<listOptionValue builtIn="false" value="boost_iostreams-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_serialization"/>
|
||||
<listOptionValue builtIn="false" value="boost_system-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_thread-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_filesystem-mt"/>
|
||||
|
@ -412,10 +412,9 @@ void IOWrapper::OutputTreeFragmentsTranslationOptions(std::ostream &out, Applica
|
||||
OutputTranslationOption(out, applicationContext, hypo, sentence, translationId);
|
||||
|
||||
const TargetPhrase &currTarPhr = hypo->GetCurrTargetPhrase();
|
||||
boost::shared_ptr<PhraseProperty> property;
|
||||
|
||||
out << " ||| ";
|
||||
if (currTarPhr.GetProperty("Tree", property)) {
|
||||
if (const PhraseProperty *property = currTarPhr.GetProperty("Tree")) {
|
||||
out << " " << property->GetValueString();
|
||||
} else {
|
||||
out << " " << "noTreeInfo";
|
||||
@ -439,10 +438,9 @@ void IOWrapper::OutputTreeFragmentsTranslationOptions(std::ostream &out, Applica
|
||||
OutputTranslationOption(out, applicationContext, applied, sentence, translationId);
|
||||
|
||||
const TargetPhrase &currTarPhr = *static_cast<const TargetPhrase*>(applied->GetNote().vp);
|
||||
boost::shared_ptr<PhraseProperty> property;
|
||||
|
||||
out << " ||| ";
|
||||
if (currTarPhr.GetProperty("Tree", property)) {
|
||||
if (const PhraseProperty *property = currTarPhr.GetProperty("Tree")) {
|
||||
out << " " << property->GetValueString();
|
||||
} else {
|
||||
out << " " << "noTreeInfo";
|
||||
|
@ -271,8 +271,7 @@ FFState* TreeStructureFeature::EvaluateChart(const ChartHypothesis& cur_hypo
|
||||
, int featureID /* used to index the state in the previous hypotheses */
|
||||
, ScoreComponentCollection* accumulator) const
|
||||
{
|
||||
boost::shared_ptr<PhraseProperty> property;
|
||||
if (cur_hypo.GetCurrTargetPhrase().GetProperty("Tree", property)) {
|
||||
if (const PhraseProperty *property = cur_hypo.GetCurrTargetPhrase().GetProperty("Tree")) {
|
||||
const std::string &tree = property->GetValueString();
|
||||
TreePointer mytree (new InternalTree(tree));
|
||||
|
||||
|
@ -248,15 +248,15 @@ void TargetPhrase::SetProperty(const std::string &key, const std::string &value)
|
||||
m_properties[key] = phrasePropertyFactory.ProduceProperty(key,value);
|
||||
}
|
||||
|
||||
bool TargetPhrase::GetProperty(const std::string &key, boost::shared_ptr<PhraseProperty> &value) const
|
||||
const PhraseProperty *TargetPhrase::GetProperty(const std::string &key) const
|
||||
{
|
||||
std::map<std::string, boost::shared_ptr<PhraseProperty> >::const_iterator iter;
|
||||
iter = m_properties.find(key);
|
||||
if (iter != m_properties.end()) {
|
||||
value = iter->second;
|
||||
return true;
|
||||
const boost::shared_ptr<PhraseProperty> &value = iter->second;
|
||||
return value.get();
|
||||
}
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TargetPhrase::SetRuleSource(const Phrase &ruleSource) const
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
|
||||
void SetProperties(const StringPiece &str);
|
||||
void SetProperty(const std::string &key, const std::string &value);
|
||||
bool GetProperty(const std::string &key, boost::shared_ptr<PhraseProperty> &value) const;
|
||||
const PhraseProperty *GetProperty(const std::string &key) const;
|
||||
|
||||
void Merge(const TargetPhrase ©, const std::vector<FactorType>& factorVec);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user