Hi, Thanks for all your reply. I found this problem when I debug extract-rules to see the extraction process. It fails to extract any rules when the src, tgt and alignment file only contain one sentence. When I copy the line several times, it can extract rules, but still, the last line is not processed. I put this line: if(tFileP->eof()) break; at the end of the while loop, and it works right now.
Also, as Kenneth said, there's a line in extract-rules.cpp: #define LINE_MAX_LENGTH 500000 When debugging with windows, maybe 50000 is enough to avoid the "stack overflow" problem. -----邮件原件----- 发件人: [email protected] [mailto:[email protected]] 代表 Kenneth Heafield 发送时间: 2011年12月15日 22:04 收件人: [email protected]; Philip James Williams 主题: Re: [Moses-support] something trivial: rule extraction in moses I believe this usage is correct. iostream sets eof() after an operation fails due to end of file. It is not set when the get pointer is at the end of file. However, I am surprised that it's stack-allocating three 500 kb char arrays then using a custom getline wrapper that checks lengths instead of using std::string for this purpose. Using 1.5 MB of stack works with linux defaults (8 MB) but probably isn't portable. Kenneth On 12/15/11 07:55, Hieu Hoang wrote: > hi xianhua > > you're probably right, if you manage to change it, please commit it back > to the repository > > Also, this comment is related > http://article.gmane.org/gmane.comp.nlp.moses.user/5715 > > On 15/12/2011 13:48, lixianhua wrote: >> >> >> >> Hi all, >> >> >> >> I am looking into rule extraction in Moses, and I found in >> the main function of “extract-rules.cpp” this line: >> >> if(tFileP->eof()) break; >> >> after getting a line from target file. >> >> this is a way to stop the extraction, but won’t it fail the last line? >> >> Why not put it at the end of the while loop? >> >> >> >> >> >> ---------------------------------------------------- >> >> Best wishes! >> >> Xianhua Li >> >> >> >> >> >> _______________________________________________ >> Moses-support mailing list >> [email protected] >> http://mailman.mit.edu/mailman/listinfo/moses-support > > > _______________________________________________ > Moses-support mailing list > [email protected] > http://mailman.mit.edu/mailman/listinfo/moses-support _______________________________________________ Moses-support mailing list [email protected] http://mailman.mit.edu/mailman/listinfo/moses-support
_______________________________________________ Moses-support mailing list [email protected] http://mailman.mit.edu/mailman/listinfo/moses-support
