diff options
author | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-05-20 18:33:47 +0400 |
---|---|---|
committer | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-05-20 18:33:47 +0400 |
commit | 8cf59edcdc8f23343fe96a794d96672c5baa6a32 (patch) | |
tree | 8bed421a7cd7b75da07dc6d4fb80d52e561cf8bb /mert | |
parent | 8a594fc254c520b62700b56fb14534be36394e06 (diff) |
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
Diffstat (limited to 'mert')
-rw-r--r-- | mert/Data.h | 3 | ||||
-rwxr-xr-x | mert/Makefile | 12 | ||||
-rw-r--r-- | mert/Scorer.h | 4 | ||||
-rw-r--r-- | mert/test_scorer.cpp | 28 |
4 files changed, 25 insertions, 22 deletions
diff --git a/mert/Data.h b/mert/Data.h index bc5588a78..eab528c72 100644 --- a/mert/Data.h +++ b/mert/Data.h @@ -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); diff --git a/mert/Makefile b/mert/Makefile index 8768060b3..b3c0c54d4 100755 --- a/mert/Makefile +++ b/mert/Makefile @@ -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 - diff --git a/mert/Scorer.h b/mert/Scorer.h index 868896709..bef8b84b0 100644 --- a/mert/Scorer.h +++ b/mert/Scorer.h @@ -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: diff --git a/mert/test_scorer.cpp b/mert/test_scorer.cpp index 05092d143..dad5e2aae 100644 --- a/mert/test_scorer.cpp +++ b/mert/test_scorer.cpp @@ -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; |