diff options
author | graehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-10 10:02:04 +0000 |
---|---|---|
committer | graehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-10 10:02:04 +0000 |
commit | 32154b45828f05add1db7c89752ef4220c0fdf16 (patch) | |
tree | fa99e4d4847a89d41b464e9ae3c9aacf611e5500 /decoder/nt_span.h | |
parent | 43db0573b15719d48b89b3a1ad2828036d008560 (diff) |
cdec --cfg_output=-
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@499 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/nt_span.h')
-rwxr-xr-x | decoder/nt_span.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/decoder/nt_span.h b/decoder/nt_span.h new file mode 100755 index 00000000..46234b07 --- /dev/null +++ b/decoder/nt_span.h @@ -0,0 +1,30 @@ +#ifndef NT_SPAN_H +#define NT_SPAN_H + +#include <iostream> +#include "wordid.h" +#include "tdict.h" + +struct Span { + int l,r; + Span() : l(-1) { } + friend inline std::ostream &operator<<(std::ostream &o,Span const& s) { + if (s.l<0) + return o; + return o<<'<'<<s.l<<','<<s.r<<'>'; + } +}; + +struct NTSpan { + Span s; + WordID nt; // awkward: this is a positive index, used in TD. but represented as negative in mixed terminal/NT space in rules/hgs. + NTSpan() : nt(0) { } + // prints as possibly empty name (whatever you set of nt,s will show) + friend inline std::ostream &operator<<(std::ostream &o,NTSpan const& t) { + if (t.nt>0) + o<<TD::Convert(t.nt); + return o << t.s; + } +}; + +#endif |