remove loadnbest from FeatureData and Scoredata; change test_scorer accordingly;

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1787 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
nicolabertoldi 2008-05-20 14:33:47 +00:00
parent 8a594fc254
commit 8cf59edcdc
4 changed files with 25 additions and 22 deletions

View File

@ -41,6 +41,9 @@ public:
inline void clear() { scoredata->clear(); featdata->clear(); }
ScoreData* getScoreData() { return scoredata; };
FeatureData* getFeatureData() { return featdata; };
void loadnbest(const std::string &file);

View File

@ -5,8 +5,8 @@ Data.o \
BleuScorer.o \
Point.o \
PerScorer.o \
Scorer.o
#Optimizer.o \
Scorer.o \
Optimizer.o \
ifndef DEBUG
CFLAGS=-O3 -DTRACE_ENABLE
@ -21,9 +21,8 @@ LDLIBS=-lm -lz
all: \
extractor \
prova-gz
#test_scorer \
#mert \
test_scorer \
mert \
clean:
rm -f *.o
@ -40,6 +39,3 @@ mert: $(OBJS) mert.cpp
test_scorer: $(OBJS) test_scorer.cpp
$(GCC) $(CFLAGS) $(OBJS) $(LDLIBS) -o $@ $@.cpp
prova-gz: $(OBJS) prova-gz.cpp
$(GCC) $(CFLAGS) $(OBJS) $(LDLIBS) -o $@ $@.cpp

View File

@ -87,8 +87,8 @@ class Scorer {
/**
* Set the score data, prior to scoring.
**/
void setScoreData(ScoreData* scoreData) {
_scoreData = scoreData;
void setScoreData(ScoreData* data) {
_scoreData = data;
}
protected:

View File

@ -2,6 +2,7 @@
#include <vector>
#include "ScoreData.h"
#include "Data.h"
#include "Scorer.h"
using namespace std;
@ -14,15 +15,16 @@ int main(int argc, char** argv) {
//bs.prepare(references, "test-scorer-data/nbest.out");
Scorer* scorer = new BleuScorer();;
scorer->setReferenceFiles(references);
ScoreData sd(*scorer);
sd.loadnbest("test_scorer_data/nbest.out");
Data d(*scorer);
d.loadnbest("test_scorer_data/nbest.out");
//sd.savetxt();
//calculate two bleu scores, nbest and a diff
scorer->setScoreData(&sd);
candidates_t candidates(sd.size());;
for (size_t i = 0; i < sd.size(); ++i) {
sd.get(i,0).savetxt("/dev/stdout");
ScoreData* sd=d.getScoreData();
scorer->setScoreData(sd);
candidates_t candidates(sd->size());;
for (size_t i = 0; i < sd->size(); ++i) {
sd->get(i,0).savetxt("/dev/stdout");
}
diffs_t diffs;
@ -38,16 +40,18 @@ int main(int argc, char** argv) {
//try the per
scorer = new PerScorer();
ScoreData psd(*scorer);
Data pd(*scorer);
scorer->setReferenceFiles(references);
psd.loadnbest("test_scorer_data/nbest.out");
pd.loadnbest("test_scorer_data/nbest.out");
//sd.savetxt();
scorer->setScoreData(&psd);
for (size_t i = 0; i < psd.size(); ++i) {
psd.get(i,0).savetxt("/dev/stdout");
}
ScoreData* psd=pd.getScoreData();
scorer->setScoreData(psd);
for (size_t i = 0; i < psd->size(); ++i) {
psd->get(i,0).savetxt("/dev/stdout");
}
cout << "PER: " << scorer->score(candidates) << endl;