summaryrefslogtreecommitdiff
path: root/dtrain/score.h
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2011-09-25 20:23:09 +0200
committerPatrick Simianer <p@simianer.de>2011-09-25 20:23:09 +0200
commit43e7ecdca09f4125346f64d45e44f440ac964421 (patch)
treea6f7bb33d1c2b2c55118286ef59ec37beba3dab6 /dtrain/score.h
parent521e8c49ad529f17f63eca1726ba8e2f564ac290 (diff)
removed some quirks, less boost, prettier code, score_t
Diffstat (limited to 'dtrain/score.h')
-rw-r--r--dtrain/score.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/dtrain/score.h b/dtrain/score.h
index 0afb6237..bff0b10c 100644
--- a/dtrain/score.h
+++ b/dtrain/score.h
@@ -15,15 +15,16 @@ namespace dtrain
{
+typedef double score_t; // float
+
struct NgramCounts
{
- NgramCounts(const size_t N) : N_(N) {
- reset();
- }
size_t N_;
map<size_t, size_t> clipped;
map<size_t, size_t> sum;
+ NgramCounts(const size_t N) : N_(N) { reset(); }
+
void
operator+=(const NgramCounts& rhs)
{
@@ -76,22 +77,22 @@ struct NgramCounts
};
typedef map<vector<WordID>, size_t> Ngrams;
+
Ngrams make_ngrams(vector<WordID>& s, size_t N);
NgramCounts make_ngram_counts(vector<WordID> hyp, vector<WordID> ref, size_t N);
-double brevity_penaly(const size_t hyp_len, const size_t ref_len);
-double bleu(NgramCounts& counts, const size_t hyp_len, const size_t ref_len, const size_t N,
- vector<float> weights = vector<float>());
-double stupid_bleu(NgramCounts& counts, const size_t hyp_len, const size_t ref_len, size_t N,
- vector<float> weights = vector<float>());
-double smooth_bleu(NgramCounts& counts, const size_t hyp_len, const size_t ref_len, const size_t N,
- vector<float> weights = vector<float>());
-double approx_bleu(NgramCounts& counts, const size_t hyp_len, const size_t ref_len, const size_t N,
- vector<float> weights = vector<float>());
+score_t brevity_penaly(const size_t hyp_len, const size_t ref_len);
+score_t bleu(NgramCounts& counts, const size_t hyp_len, const size_t ref_len, const size_t N,
+ vector<score_t> weights = vector<score_t>());
+score_t stupid_bleu(NgramCounts& counts, const size_t hyp_len, const size_t ref_len, size_t N,
+ vector<score_t> weights = vector<score_t>());
+score_t smooth_bleu(NgramCounts& counts, const size_t hyp_len, const size_t ref_len, const size_t N,
+ vector<score_t> weights = vector<score_t>());
+score_t approx_bleu(NgramCounts& counts, const size_t hyp_len, const size_t ref_len, const size_t N,
+ vector<score_t> weights = vector<score_t>());
} // namespace
-
#endif