mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
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:
parent
8a594fc254
commit
8cf59edcdc
@ -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);
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user