安装 YamCha 包时出错

Error while installating YamCha Package

我尝试安装 YamCha 用于 NLP 任务的工具,例如 NER、POS 和分块。

在尝试安装时,我按照安装步骤进行了操作

% ./configure 
% make
% make check
% su
# make install

我收到以下错误消息:-

param.cpp: In member function 'bool YamCha::Param::open(int, char**, const YamCha::Option*)': param.cpp:102:42: error: 'strlen' was not declared in this scope size_t nlen = strlen (opts[i].name); ^ param.cpp:103:68: error: 'strncmp' was not declared in this scope if (nlen == len && strncmp (&argv[ind][2], opts[i].name, len) == 0) { ^ param.cpp: In member function 'bool YamCha::Param::open(const char*, const YamCha::Option*)': param.cpp:182:28: error: 'strncpy' was not declared in this scope strncpy (str, arg, 1024); ^ param.cpp:185:12: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] make all-recursive make1: Entering directory /home/hamada/Documents/YamCha/yamcha-0.33' Making all in src make[2]: Entering directory/home/hamada/Documents/YamCha/yamcha-0.33/src' /bin/bash ../libtool --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -I. -I. -I.. -O3 -Wno-deprecated -Wall -c -o param.lo param.cpp g++ -DHAVE_CONFIG_H -I. -I. -I.. -O3 -Wno-deprecated -Wall -c param.cpp -fPIC -DPIC -o .libs/param.o ptr[0] = PACKAGE; ^ param.cpp: In member function 'void YamCha::Param::help(std::ostream&, const YamCha::Option*)': param.cpp:205:42: error: 'strlen' was not declared in this scope size_t l = 1 + strlen (opts[i].name); ^ param.cpp:211:38: error: 'strlen' was not declared in this scope size_t l = strlen (opts[i].name); ^ make[2]: * [param.lo] Error 1 make[2]: Leaving directory /home/hamada/Documents/YamCha/yamcha-0.33/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/home/hamada/Documents/YamCha/yamcha-0.33' make: * [all] Error 2

您的代码文件中缺少头文件。您在上面提供的 link 包含一个源文件 src/common.h ,只需在该文件中添加 #include<string.h> 即可。有了这个添加,它应该可以工作。