From 107bfa62f0c6255c4e110166862cc790caf0e396 Mon Sep 17 00:00:00 2001 From: Oneplus Date: Wed, 4 Sep 2013 14:15:49 +0800 Subject: [PATCH] fix bug in erase space after split sentence --- conf/ltp.cnf | 10 +++++----- conf/ltp_all_modules.conf.in | 5 ----- src/_split_sentence/SplitSentence.cpp | 16 ++++++---------- src/_split_sentence/SplitSentence.h | 3 ++- tools/testing/auto-test.sh.in | 23 ----------------------- 5 files changed, 13 insertions(+), 44 deletions(-) delete mode 100644 conf/ltp_all_modules.conf.in delete mode 100755 tools/testing/auto-test.sh.in diff --git a/conf/ltp.cnf b/conf/ltp.cnf index 31d38f680..585c659b5 100644 --- a/conf/ltp.cnf +++ b/conf/ltp.cnf @@ -1,5 +1,5 @@ -segmentor-model = new_ltp_data/cws.model -postagger-model = new_ltp_data/pos.model -parser-model = new_ltp_data/parser.model -ner-model = new_ltp_data/ne_data -srl-data = new_ltp_data/srl/ +segmentor-model = ltp_data/cws.model +postagger-model = ltp_data/pos.model +parser-model = ltp_data/parser.model +ner-model = ltp_data/ner.model +srl-data = ltp_data/srl/ diff --git a/conf/ltp_all_modules.conf.in b/conf/ltp_all_modules.conf.in deleted file mode 100644 index ec21bdf37..000000000 --- a/conf/ltp_all_modules.conf.in +++ /dev/null @@ -1,5 +0,0 @@ -#LTP data file path - -LTP_dataFolder=${MODEL_DIR}/ - -#--------------------------------# diff --git a/src/_split_sentence/SplitSentence.cpp b/src/_split_sentence/SplitSentence.cpp index f0205a86c..db426e0ba 100644 --- a/src/_split_sentence/SplitSentence.cpp +++ b/src/_split_sentence/SplitSentence.cpp @@ -1,21 +1,17 @@ #include "SplitSentence.h" //#include "SentenceIterator.h" #include +#include "strutils.hpp" #include "sentsplit.hpp" //using namespace util; int SplitSentence( const std::string& strPara, std::vector& vecSentence ) { ltp::Chinese::split_sentence(strPara, vecSentence); - /*StringReader sr( strPara.c_str() ); - Separator sep; - sentence_iterator si(&sr, sep), send; - vecSentence.clear(); - while( si != send ) { - if(strlen(*si) < 400){ - vecSentence.push_back( *si ); - } - si++; - }*/ + + for (int i = 0; i < vecSentence.size(); ++ i) { + vecSentence[i] = ltp::strutils::chomp(vecSentence[i]); + } + return 1; } diff --git a/src/_split_sentence/SplitSentence.h b/src/_split_sentence/SplitSentence.h index dff46dd39..f95ee9ceb 100644 --- a/src/_split_sentence/SplitSentence.h +++ b/src/_split_sentence/SplitSentence.h @@ -9,4 +9,5 @@ // return (int)vecSentence.size(); int SplitSentence( const std::string& strPara, std::vector& vecSentence ); -#endif //__SPLIT_SENTENCE_H__ \ No newline at end of file +#endif //__SPLIT_SENTENCE_H__ + diff --git a/tools/testing/auto-test.sh.in b/tools/testing/auto-test.sh.in deleted file mode 100755 index 27fe661e6..000000000 --- a/tools/testing/auto-test.sh.in +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -ROOT_DIR=${PROJECT_SOURCE_DIR} -BIN_DIR=${EXECUTABLE_OUTPUT_PATH} -DATA_DIR=${DATA_DIR} - -EXE=./ltp_test -OPT=all - -cd $BIN_DIR - -echo "[Running]"; -$EXE $OPT $DATA_DIR/test_gb.txt > $DATA_DIR/test_gb.tmp -echo "[Finished]"; - -cd $DATA_DIR -diff $DATA_DIR/test_gb.xml $DATA_DIR/test_gb.tmp - -if [ $? == 0 ]; then - echo "[Passed] no diff" -else - echo "[Failed] found diff between two version's output" -fi