summaryrefslogtreecommitdiff
path: root/decoder/ff_from_fsa.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-23 22:12:00 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-23 22:12:00 +0000
commitb9574d2c459b60037bf1e97e64e0c4aed524a71c (patch)
tree6bc3d0e609352fef7e9c7b776fd8475c90fe399e /decoder/ff_from_fsa.h
parent7d29a7baf144090f61c8f0b9665bab7eb271f3a2 (diff)
pretty
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@389 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/ff_from_fsa.h')
-rwxr-xr-xdecoder/ff_from_fsa.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/decoder/ff_from_fsa.h b/decoder/ff_from_fsa.h
index 820f2433..03de25f8 100755
--- a/decoder/ff_from_fsa.h
+++ b/decoder/ff_from_fsa.h
@@ -77,21 +77,21 @@ public:
WP al=(WP)a;
WP ale=left_end(a);
// scan(al,le) these - the same as below else. macro for now; pull into closure object later?
- int nw=ale-al;
- if (left_out+nw<left_full) { // nothing to score
+ int nw=ale-al; // this many new words
+ if (left_out+nw<left_full) { // nothing to score after adding
wordcpy(left_out,al,nw);
left_out+=nw;
- } else if (left_out<left_full) { // something to score AND left context to fill
+ } else if (left_out<left_full) { // something to score AND newly full left context to fill
int ntofill=left_full-left_out;
+ assert(ntofill==M-(left_out-left_begin));
wordcpy(left_out,al,ntofill);
left_out=(W)left_full;
// heuristic known now
fsa.reset(h_start);
fsa.scan(left_begin,left_full,estimated_features); // save heuristic (happens once only)
+ fsa.scan(al+ntofill,ale,features);
al+=ntofill; // we used up the first ntofill words of al to end up in some known state via exactly M words total (M-ntofill were there beforehand). now we can scan the remaining al words of this child
- goto scan;
- } else { // more to score / state to update
- scan:
+ } else { // more to score / state to update (left already full)
fsa.scan(al,ale,features);
}
if (nw>M) // child had full state already (had a "gap"); if nw==M then we already reached the same state via left word heuristic scan above
@@ -111,11 +111,11 @@ public:
}
}
- if (left_out<left_full) { // finally: partial heuristic fo runfilled items
+ if (left_out<left_full) { // finally: partial heuristic foru nfilled items
fsa.reset(h_start);
- fsa.scan(left_begin,left_out,estimated_features); // save heuristic (happens once)
+ fsa.scan(left_begin,left_out,estimated_features);
clear_fsa_state(out_state); // 0 bytes so we compare / hash correctly. don't know state yet
- while(left_out<left_full) *left_out++=TD::none; // mark as partial left word seq
+ do { *left_out++=TD::none; } while(left_out<left_full); // none-terminate so left_end(out_state) will know how many words
} else // or else store final right-state. heuristic was already assigned
fstatecpy(out_state,fsa.cs);
FSAFFDBG(" = " << describe_state(out_state)<<" "<<(*features)[ff.fid()]<<" h="<<(*estimated_features)[ff.fid()]<<'\n');