Skip to content

Commit

Permalink
modify the interface of test program
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangfeng1124 committed Apr 2, 2013
1 parent 8f53314 commit 7e9bbe2
Show file tree
Hide file tree
Showing 2 changed files with 571 additions and 27,255 deletions.
14 changes: 8 additions & 6 deletions test/ltp_test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ static LTP ltp(xml4nlp);

int main(int argc, char *argv[])
{
if (argc != 3)
if (argc != 4)
{
cerr << "Usage: ./ltp_test <type> <test_file>" << endl;
cerr << "Usage: ./ltp_test <type> <test_file> <result_file>" << endl;
exit(1);
}

string type(argv[1]);
string in(argv[2]);
string in_file(argv[2]);
string res_file(argv[3]);

xml4nlp.CreateDOMFromFile(in.c_str());
xml4nlp.CreateDOMFromFile(in_file.c_str());

if (type == "ws") {
ltp.crfWordSeg();
Expand All @@ -42,9 +43,10 @@ int main(int argc, char *argv[])

string result;
xml4nlp.SaveDOM(result);
ofstream out((in + ".xml").c_str());

ofstream out(res_file.c_str());
out << result << endl;
cerr << "Results saved to " << (in + ".xml") << endl;
cerr << "Results saved to " << res_file << endl;

xml4nlp.ClearDOM();

Expand Down
Loading

0 comments on commit 7e9bbe2

Please sign in to comment.