diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-23 02:27:28 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-23 02:27:28 +0000 |
commit | 8c6536c56c728213b9e1190f0c9f76f7b4948140 (patch) | |
tree | ab192e932935ea25f77924836e40e9adf0034caa /decoder/sentences.h | |
parent | 9ac87abac855aaaa6c1dcf686b38443092a10ce6 (diff) |
bottom-up FF from fsa FF - WordPenaltyFsa - needs debugging
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@373 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/sentences.h')
-rwxr-xr-x | decoder/sentences.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/decoder/sentences.h b/decoder/sentences.h index 6ab216bf..482d3be9 100755 --- a/decoder/sentences.h +++ b/decoder/sentences.h @@ -7,8 +7,30 @@ #include "filelib.h" #include "tdict.h" #include "stringlib.h" +#include <cstring> typedef std::vector<WordID> Sentence; +// these "iterators" are invalidated if s is modified. note: this is allowed by std. +inline WordID const* begin(Sentence const& s) { + return &*s.begin(); +} +inline WordID const* end(Sentence const& s) { + return &*s.end(); +} +inline WordID * begin(Sentence & s) { + return &*s.begin(); +} +inline WordID * end(Sentence & s) { + return &*s.end(); +} +inline void wordcpy(WordID *dest,WordID const* src,int n) { + std::memcpy(dest,src,n*sizeof(*dest)); +} +inline void wordcpy(WordID *dest,WordID const* src,WordID const* src_end) { + wordcpy(dest,src,src_end-src); +} + + inline std::ostream & operator<<(std::ostream &out,Sentence const& s) { return out<<TD::GetString(s); } |