summaryrefslogtreecommitdiff
path: root/vest/error_surface.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-01-27 02:31:00 -0500
committerChris Dyer <cdyer@cs.cmu.edu>2012-01-27 02:31:00 -0500
commit481a120564fdb73c8c6833e2102acb533683261c (patch)
treec4b39308283f8f5b64ac13691b1d29de31cc15ce /vest/error_surface.cc
parent4c2360119def2fb624d2691b355b1908c511f004 (diff)
migrate mert to the new scorer interface
Diffstat (limited to 'vest/error_surface.cc')
-rw-r--r--vest/error_surface.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/vest/error_surface.cc b/vest/error_surface.cc
index 754aa8de..515b67f8 100644
--- a/vest/error_surface.cc
+++ b/vest/error_surface.cc
@@ -5,8 +5,7 @@
using namespace std;
-ErrorSurface::~ErrorSurface() {
-}
+ErrorSurface::~ErrorSurface() {}
void ErrorSurface::Serialize(std::string* out) const {
const int segments = this->size();
@@ -15,8 +14,8 @@ void ErrorSurface::Serialize(std::string* out) const {
for (int i = 0; i < segments; ++i) {
const ErrorSegment& cur = (*this)[i];
string senc;
- cur.delta->Encode(&senc);
- assert(senc.size() < 256);
+ cur.delta.Encode(&senc);
+ assert(senc.size() < 1024);
unsigned char len = senc.size();
os.write((const char*)&cur.x, sizeof(cur.x));
os.write((const char*)&len, sizeof(len));
@@ -25,7 +24,7 @@ void ErrorSurface::Serialize(std::string* out) const {
*out = os.str();
}
-void ErrorSurface::Deserialize(ScoreType type, const std::string& in) {
+void ErrorSurface::Deserialize(const std::string& in) {
istringstream is(in, ios::binary);
int segments;
is.read((char*)&segments, sizeof(segments));
@@ -37,7 +36,7 @@ void ErrorSurface::Deserialize(ScoreType type, const std::string& in) {
is.read((char*)&len, sizeof(len));
string senc(len, '\0'); assert(senc.size() == len);
is.read((char*)&senc[0], len);
- cur.delta = SentenceScorer::CreateScoreFromString(type, senc);
+ cur.delta = SufficientStats(senc);
}
}