Skip to content

Commit

Permalink
fix rewrite ltp_dll
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneplus committed Jul 19, 2013
1 parent dac86c1 commit 714acb6
Show file tree
Hide file tree
Showing 44 changed files with 1,277 additions and 1,176 deletions.
19 changes: 13 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
set (util_DIR ${SOURCE_DIR}/__util/)
set (utils_DIR ${SOURCE_DIR}/utils)
set (xml4nlp_DIR ${SOURCE_DIR}/__xml4nlp/)
set (crfwordseg_DIR ${SOURCE_DIR}/_crfwordsegment/)
set (svmtagger_DIR ${SOURCE_DIR}/_svmtagger/)
#set (crfwordseg_DIR ${SOURCE_DIR}/_crfwordsegment/)
set (segmentor_DIR ${SOURCE_DIR}/segmentor)
set (postagger_DIR ${SOURCE_DIR}/postagger)
set (parser_DIR ${SOURCE_DIR}/parser)
#set (svmtagger_DIR ${SOURCE_DIR}/_svmtagger/)
set (splitsnt_DIR ${SOURCE_DIR}/_split_sentence/)
set (ner_DIR ${SOURCE_DIR}/_ner/)
set (gparser_DIR ${SOURCE_DIR}/_gparser)
#set (gparser_DIR ${SOURCE_DIR}/_gparser)
set (srl_DIR ${SOURCE_DIR}/_srl/)
set (ltp_dll_DIR ${SOURCE_DIR}/__ltp_dll/)

add_subdirectory ("__util")
add_subdirectory ("__xml4nlp")
add_subdirectory ("_split_sentence")
add_subdirectory ("_crfwordsegment")
add_subdirectory ("_svmtagger")
add_subdirectory ("segmentor")
add_subdirectory ("postagger")
add_subdirectory ("parser")
#add_subdirectory ("_crfwordsegment")
#add_subdirectory ("_svmtagger")
add_subdirectory ("_ner")
add_subdirectory ("_gparser")
#add_subdirectory ("_gparser")
add_subdirectory ("_srl")

add_subdirectory ("__ltp_dll")
Expand Down
12 changes: 8 additions & 4 deletions src/__ltp_dll/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
include_directories (./
${xml4nlp_DIR}
${util_DIR}
${crfwordseg_DIR}
${svmtagger_DIR}
${gparser_DIR}
${utils_DIR}
#${crfwordseg_DIR}
#${svmtagger_DIR}
#${gparser_DIR}
${splitsnt_DIR}
${segmentor_DIR}
${postagger_DIR}
${parser_DIR}
${ner_DIR}
${srl_DIR}
${splitsnt_DIR}
${THIRDPARTY_DIR}/tinyxml)

SET(ltp_SRC
Expand Down
107 changes: 41 additions & 66 deletions src/__ltp_dll/LTPOption.h
Original file line number Diff line number Diff line change
@@ -1,78 +1,53 @@
#ifndef _LTP_OPTION_
#define _LTP_OPTION_
#ifndef __LTP_OPTION__
#define __LTP_OPTION__

#include <string>
#include <iostream>
using namespace std;
/*
isPER用于设置是否使用人名识别,若用则为1,否则为0。
isLOC用于设置是否使用地名识别,
isPOS用于设置是否进行词性标注。
但要使用这些,需在配置文件中选择加载了相关的资源才行。
*/

struct tagIRLASOption{
int isPER;
int isLOC;
int isPOS;
string confFile;
string dataFolder;

tagIRLASOption(int aIsPER=1, int aIsLOC=1, int aIsPOS=1) : isPER(aIsPER), isLOC(aIsLOC), isPOS(aIsPOS) {}
struct tagIRLASOption &operator=(const struct tagIRLASOption &irlasOpt)
{
isPER = irlasOpt.isPER;
isLOC = irlasOpt.isLOC;
isPOS = irlasOpt.isPOS;
return *this;
}
void output()
{
cout << "IRLAS options: " << endl
<< "isPER: " << isPER << endl
<< "isLOC: " << isLOC << endl
<< "isPOS: " << isPOS << endl
<< "confFile: \"" << confFile << "\"" << endl;
}
};
typedef struct tagIRLASOption IRLASOption;
struct tagNEOption {
int isEntity;
int isTime;
int isNum;

struct tagNEOption{
int isEntity;
int isTime;
int isNum;
tagNEOption(int aIsEntity=1, int aIsTime=1, int aIsNum=1) :
isEntity(aIsEntity),
isTime(aIsTime),
isNum(aIsNum) {}

tagNEOption(int aIsEntity=1, int aIsTime=1, int aIsNum=1) : isEntity(aIsEntity), isTime(aIsTime), isNum(aIsNum) {}
struct tagNEOption& operator=(const struct tagNEOption &neOpt)
{
isEntity = neOpt.isEntity;
isTime = neOpt.isTime;
isNum = neOpt.isNum;
return *this;
}
struct tagNEOption& operator=(const struct tagNEOption & neOpt) {
isEntity = neOpt.isEntity;
isTime = neOpt.isTime;
isNum = neOpt.isNum;
return *this;
}

void output()
{
cout << "NE options: " << endl
<< "isEntity: " << isEntity << endl
<< "isTime: " << isTime << endl
<< "isNum: " << isNum << endl;
}
void output() {
std::cout << "NE options" << std::endl
<< "isEntity : " << isEntity << std::endl
<< "isTime : " << isTime << std::endl
<< "isNum : " << isNum << std::endl;
}
};

typedef struct tagNEOption NEOption;

struct tagLTPOption
{
string strLTPDataPath;
IRLASOption irlasOpt;
NEOption neOpt;
void output()
{
cout << "ltp options: " << endl
<< "ltp data path: " << strLTPDataPath << endl;
irlasOpt.output();
neOpt.output();
}
struct tagLTPOption {
std::string strLTPDataPath;
std::string segmentor_model_path;
std::string postagger_model_path;
std::string parser_model_path;
std::string ner_data_dir;
std::string srl_data_dir;

NEOption neOpt;

void output() {
std::cout << "ltp options : " << std::endl
<< "ltp data path : " << strLTPDataPath << std::endl;
neOpt.output();
}
};

typedef tagLTPOption LTPOption;

#endif
#endif // end for __LTP_OPTION__
Loading

0 comments on commit 714acb6

Please sign in to comment.