summaryrefslogtreecommitdiff
path: root/vest/error_surface.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2012-03-13 09:24:47 +0100
committerPatrick Simianer <p@simianer.de>2012-03-13 09:24:47 +0100
commitef6085e558e26c8819f1735425761103021b6470 (patch)
tree5cf70e4c48c64d838e1326b5a505c8c4061bff4a /vest/error_surface.cc
parent10a232656a0c882b3b955d2bcfac138ce11e8a2e (diff)
parentdfbc278c1057555fda9312291c8024049e00b7d8 (diff)
merge with upstream
Diffstat (limited to 'vest/error_surface.cc')
-rw-r--r--vest/error_surface.cc43
1 files changed, 0 insertions, 43 deletions
diff --git a/vest/error_surface.cc b/vest/error_surface.cc
deleted file mode 100644
index 754aa8de..00000000
--- a/vest/error_surface.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "error_surface.h"
-
-#include <cassert>
-#include <sstream>
-
-using namespace std;
-
-ErrorSurface::~ErrorSurface() {
-}
-
-void ErrorSurface::Serialize(std::string* out) const {
- const int segments = this->size();
- ostringstream os(ios::binary);
- os.write((const char*)&segments,sizeof(segments));
- for (int i = 0; i < segments; ++i) {
- const ErrorSegment& cur = (*this)[i];
- string senc;
- cur.delta->Encode(&senc);
- assert(senc.size() < 256);
- unsigned char len = senc.size();
- os.write((const char*)&cur.x, sizeof(cur.x));
- os.write((const char*)&len, sizeof(len));
- os.write((const char*)&senc[0], len);
- }
- *out = os.str();
-}
-
-void ErrorSurface::Deserialize(ScoreType type, const std::string& in) {
- istringstream is(in, ios::binary);
- int segments;
- is.read((char*)&segments, sizeof(segments));
- this->resize(segments);
- for (int i = 0; i < segments; ++i) {
- ErrorSegment& cur = (*this)[i];
- unsigned char len;
- is.read((char*)&cur.x, sizeof(cur.x));
- 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);
- }
-}
-