00001
00002
00003
00004
00005 #include <sstream>
00006
00007 #include "ug_mm_ttrack.h"
00008 #include "tpt_pickler.h"
00009
00010 namespace sapt
00011 {
00012 using namespace std;
00013
00014 #if 0
00015 template<>
00016 id_type
00017 Ttrack<id_type>::
00018 toID(id_type const& t)
00019 {
00020 return t;
00021 }
00022 #endif
00023
00025 template<>
00026 string
00027 Ttrack<id_type>::
00028 str(id_type sid, TokenIndex const& T) const
00029 {
00030 assert(sid < numTokens());
00031 id_type const* stop = sntEnd(sid);
00032 id_type const* strt = sntStart(sid);
00033 ostringstream buf;
00034 if (strt < stop) buf << T[*strt];
00035 while (++strt < stop)
00036 buf << " " << T[*strt];
00037 return buf.str();
00038 }
00039
00040 size_t
00041 len_from_pid(uint64_t pid)
00042 {
00043 static uint64_t two16 = uint64_t(1)<<16;
00044 return pid%two16;
00045 }
00046
00047 #if 0
00048 template<>
00049 string
00050 Ttrack<id_type>::
00051 str(id_type sid, Vocab const& V) const
00052 {
00053 assert(sid < numTokens());
00054 id_type const* stop = sntEnd(sid);
00055 id_type const* strt = sntStart(sid);
00056 ostringstream buf;
00057 if (strt < stop) buf << V[*strt].str;
00058 while (++strt < stop)
00059 buf << " " << V[*strt].str;
00060 return buf.str();
00061 }
00062 #endif
00063 }