I enclose a patch to get it to compile.
-- Beppe
On 4/5/2010 12:45, Felipe Sánchez Martínez wrote:
Hi,
I guess you mean to query a phrase table on disk. If my guess is
correct, the code attached might help you.
Regards
--
Felipe
El 04/04/10 23:55, Giuseppe Attardi escribió:
Has anyone developed a tool for querying a phrase table directly?
-- Beppe
*** pmoses.cc 2010-04-06 19:33:44.131555105 +0200
--- pmoses.cc~ 2010-04-06 19:06:45.212467838 +0200
***************
*** 35,42 ****
int main (int argc, char *argv[]) {
vector<FactorType> input, output;
vector<float> weight;
! size_t numScoreComponent=5;
! unsigned numInputScores=0;
int tableLimit=0;
int weightWP=0;
LMList lmList;
--- 35,42 ----
int main (int argc, char *argv[]) {
vector<FactorType> input, output;
vector<float> weight;
! int numScoreComponent=5;
! int numInputScores=0;
int tableLimit=0;
int weightWP=0;
LMList lmList;
***************
*** 60,68 ****
source_str+=argv[i];
}
! const PhraseDictionaryFeature* feature;
! PhraseDictionaryTreeAdaptor *pd=new
PhraseDictionaryTreeAdaptor(numScoreComponent, numInputScores, feature);
!
cerr<<"Table limit: "<<tableLimit<<endl;
cerr<<"WeightWordPenalty: "<<weightWP<<endl;
cerr<<"Source phrase: ___"<<source_str<<"___"<<endl;
--- 60,67 ----
source_str+=argv[i];
}
! PhraseDictionaryTreeAdaptor *pd=new
PhraseDictionaryTreeAdaptor(numScoreComponent, numInputScores);
!
cerr<<"Table limit: "<<tableLimit<<endl;
cerr<<"WeightWordPenalty: "<<weightWP<<endl;
cerr<<"Source phrase: ___"<<source_str<<"___"<<endl;
***************
*** 84,92 ****
stringstream strs;
strs<<static_cast<const Phrase&>(*(*iterTargetPhrase));
! string s = strs.str();
! Utils::trim(s);
! cerr<<source_str<<" => ___"<< s <<"___ ";
ScoreComponentCollection scc = (*iterTargetPhrase)->GetScoreBreakdown();
cerr<<"Scores: ";
for(unsigned i=0; i<scc.size(); i++) {
--- 83,89 ----
stringstream strs;
strs<<static_cast<const Phrase&>(*(*iterTargetPhrase));
! cerr<<source_str<<" => ___"<<Utils::trim(strs.str())<<"___ ";
ScoreComponentCollection scc = (*iterTargetPhrase)->GetScoreBreakdown();
cerr<<"Scores: ";
for(unsigned i=0; i<scc.size(); i++) {
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support