diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f4176b..56a7d0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,15 +5,15 @@ CMAKE_MINIMUM_REQUIRED (VERSION 2.6) if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set (CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "default install path" FORCE ) endif() + ADD_DEFINITIONS(-O3 -Wall -g) IF (DEFINED ENC) ADD_DEFINITIONS(-DCPPJIEBA_${ENC}) ENDIF() -#ADD_DEFINITIONS(-DNO_FILTER) -ADD_SUBDIRECTORY(src) -ADD_SUBDIRECTORY(dict) IF("${CMAKE_SYSTEM}" MATCHES "Linux") +ADD_SUBDIRECTORY(server) +ADD_SUBDIRECTORY(dict) ADD_SUBDIRECTORY(script) ADD_SUBDIRECTORY(conf) endif() diff --git a/README.md b/README.md index 9281793..ac8f345 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ make test ``` #Usage: /etc/init.d/cjserver {start|stop|restart|force-reload} -/etc/init.d/cjserver.start +/etc/init.d/cjserver.start >> /dev/null 2>&1 /etc/init.d/cjserver.stop ``` diff --git a/script/CMakeLists.txt b/script/CMakeLists.txt index ff4f353..cfbc28e 100644 --- a/script/CMakeLists.txt +++ b/script/CMakeLists.txt @@ -1,2 +1 @@ INSTALL(PROGRAMS cjserver.start cjserver.stop DESTINATION /etc/init.d/) -INSTALL(PROGRAMS cjseg.sh DESTINATION bin) diff --git a/script/cjseg.sh b/script/cjseg.sh deleted file mode 100755 index cc9a513..0000000 --- a/script/cjseg.sh +++ /dev/null @@ -1,5 +0,0 @@ -if [ $# -lt 1 ]; then - echo "usage: $0 " - exit 1 -fi -cjsegment --dictpath /usr/share/CppJieba/dict/jieba.dict.utf8 --modelpath /usr/share/CppJieba/dict/hmm_model.utf8 $1 diff --git a/src/CMakeLists.txt b/server/CMakeLists.txt similarity index 62% rename from src/CMakeLists.txt rename to server/CMakeLists.txt index 5fc6ee9..3069a93 100644 --- a/src/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,12 +1,9 @@ SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) -SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src) -ADD_EXECUTABLE(cjsegment segment.cpp) ADD_EXECUTABLE(cjserver server.cpp) TARGET_LINK_LIBRARIES(cjserver pthread) -INSTALL(TARGETS cjsegment RUNTIME DESTINATION bin) INSTALL(TARGETS cjserver RUNTIME DESTINATION bin) diff --git a/src/Husky/EpollServer.hpp b/server/Husky/EpollServer.hpp similarity index 100% rename from src/Husky/EpollServer.hpp rename to server/Husky/EpollServer.hpp diff --git a/src/Husky/HttpReqInfo.hpp b/server/Husky/HttpReqInfo.hpp similarity index 100% rename from src/Husky/HttpReqInfo.hpp rename to server/Husky/HttpReqInfo.hpp diff --git a/src/server.cpp b/server/server.cpp similarity index 100% rename from src/server.cpp rename to server/server.cpp diff --git a/src/segment.cpp b/src/segment.cpp deleted file mode 100644 index 6c67f2d..0000000 --- a/src/segment.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include -#include -#include -#include "Limonp/ArgvContext.hpp" -#include "MPSegment.hpp" -#include "HMMSegment.hpp" -#include "MixSegment.hpp" -#include "FullSegment.hpp" -#include "QuerySegment.hpp" - -using namespace CppJieba; - -void cut(const ISegment * seg, const char * const filePath) -{ - ifstream ifile(filePath); - vector res; - string line; - while(getline(ifile, line)) - { - if(!line.empty()) - { - cout << line << endl; - res.clear(); - if(!seg->cut(line, res)) - { - LogError("seg cut failed."); - } - else - { - print(join(res.begin(), res.end(), "/")); - } - } - } -} - -int main(int argc, char ** argv) -{ - if(argc < 2) - { - cout<<"usage: \n\t"<\n" - <<"options:\n" - <<"\t--algorithm\tSupported methods are [cutDAG, cutHMM, cutFull, cutQuery, cutMix] for now. \n\t\t\tIf not specified, the default is cutMix\n" - <<"\t--dictpath\tsee example\n" - <<"\t--modelpath\tsee example\n" - <<"\t--maxlen\tspecify the granularity of cut used in cutQuery. \n\t\t\tIf not specified, the default is 3\n" - <<"example:\n" - <<"\t"<