Skip to content

Commit

Permalink
Merge branch 'ltp-new-framework' of https://github.com/HIT-SCIR/ltp i…
Browse files Browse the repository at this point in the history
…nto ltp-new-framework
  • Loading branch information
carfly committed Jul 25, 2013
2 parents 2a9231d + a47f8a7 commit edb5225
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/__xml4nlp/Xml4nlp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ int XML4NLP::CreateDOMFromString(const string& str) {
string strTmp = str;
replace_char_by_char(strTmp, '\r', '\n');

std::cout << strTmp << std::endl;
istringstream in(strTmp); // How to use istringstream?
string line;
int i = 0;
Expand Down
12 changes: 11 additions & 1 deletion test/ltp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,20 @@ int main(int argc, char *argv[]) {
exit(1);
}

while(in >> sentence){
while(std::getline(in, sentence)){
int len = sentence.size();
while ( sentence[len-1]=='\n' || sentence[len-1]=='\r' ) {
-- len;
}
if (len == 0) {
continue;
}
sentence = sentence.substr(0, len);

cout << "Input sentence is: " << sentence << endl;

xml4nlp.CreateDOMFromString(sentence);

if(type == "ws"){
ltp.wordseg();
} else if(type == "pos"){
Expand Down

0 comments on commit edb5225

Please sign in to comment.