sclite(SCTK),C ++模板参数Filter :: Filter *无效.西格温 [英] sclite (SCTK), C++ template argument, Filter::Filter* , is invalid. Cygwin

查看:127
本文介绍了sclite(SCTK),C ++模板参数Filter :: Filter *无效.西格温的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在尝试安装NIST的sclite,它是SCTK 2.4.0的一部分( github 更新的版本).我正在尝试在bash中的Cygwin上进行安装.使用make完成安装.

I am currently trying to install NIST's sclite, which is part of SCTK 2.4.0 (github or newer version). I am attempting the install on Cygwin in bash. The installation is done using make.

我可以通过进行64位编译来解决file [format] not recognized的问题,如另一中进行了详细说明

I was able to get past an issue with file [format] not recognized by doing a 64-bit compilation, as described at the end of the README and as explained in detail in another of my SO posts.

现在,我再次按照安装说明,并收到以下错误消息键入make all

Now, I again follow the installation instructions and get the following error after typing make all

In file included from main.cpp:20:0:
recording.h:122:36: error: template argument 2 is invalid
         map<string, Filter::Filter*> filters;
                                    ^
recording.h:122:36: error: template argument 4 is invalid
make[3]: *** [makefile:59: main.o] Error 1
make[3]: Leaving directory 
'/cygdrive/c/Me/programs/nist/sctk/src/asclite/core'
make[2]: *** [makefile:12: all] Error 2
make[2]: Leaving directory 
'/cygdrive/c/Me/programs/nist/sctk/src/asclite'
make[1]: *** [makefile:12: all] Error 2
make[1]: Leaving directory '/cygdrive/c/Me/programs/nist/sctk/src'
make: *** [makefile:20: all] Error 2

有人知道我可以做什么来完成安装吗?

Does anyone know what I can do to complete the install?

注意:回答了此处的问题后,安装实际上并未在Cygwin上完成.在之前之后,我将在进度中发布SO,并询问下一步的问题.

Note: When the question here is answered, the install doesn't actually complete on Cygwin. There are things to do before and after, which I'm posting on SO with my progress and with questions on where to go next.

我在C ++文档中没有找到关于Filter的任何信息,而对克隆目录($ find . -type f \( -name "*.h" -o -name "*.c" -o -name "*.cpp" \) -print0 | xargs -I'{}' -0 grep -Hn "Filter" {})中的文件进行搜索可以部分得到

I haven't found anything about Filter in C++ docs, and a search through the files in the cloned directory ( $ find . -type f \( -name "*.h" -o -name "*.c" -o -name "*.cpp" \) -print0 | xargs -I'{}' -0 grep -Hn "Filter" {} ) gives, in part:

./src/asclite/core/checker.h:26:class Checker : public Filter
./src/asclite/core/filter.cpp:19: * Abstract interface to a Filter.
./src/asclite/core/filter.cpp:25:Filter::Filter()
./src/asclite/core/filter.cpp:30:Filter::~Filter()
./src/asclite/core/filter.h:26: * Abstract interface to a Filter.
./src/asclite/core/filter.h:28:class Filter
./src/asclite/core/filter.h:32:         Filter();
./src/asclite/core/filter.h:34:         virtual ~Filter();

...

据我所知,这意味着在名称空间Filter中有一个构造函数Filter.

Which, as far as I can tell, means that there is a constructor, Filter in the namespace, Filter.

这是filter.cpp

$ cat src/asclite/core/filter.cpp | tail -16

/**
 * Abstract interface to a Filter.
 */

#include "filter.h" // class's header file

// class constructor
Filter::Filter()
{
}

// class destructor
Filter::~Filter()
{
}

这是filter.h

$ cat src/asclite/core/filter.h | tail -27

#ifndef FILTER_H
#define FILTER_H

#include "stdinc.h"
#include "speech.h"
#include "speechset.h"

/**
 * Abstract interface to a Filter.
 */
class Filter
{
        public:
                // class constructor
                Filter();
                // class destructor
                virtual ~Filter();

                virtual bool isProcessAllSpeechSet() = 0;
                virtual unsigned long int ProcessSingleSpeech(Speech* speech) = 0;
                virtual unsigned long int ProcessSpeechSet(SpeechSet* ref, map<string, SpeechSet*> &hyp) = 0;

                virtual void LoadFile(const string& filename) = 0;
};

#endif // FILTER_H


系统详细信息


System Details

$ uname -a
CYGWIN_NT-6.1 CAP-D-ENG-INT3 2.10.0(0.325/5/3) 2018-02-02 15:16 x86_64 Cygwin
$ bash --version
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) ...
$ gcc --version
gcc (GCC) 6.4.0 ...
$ g++ --version
g++ (GCC) 6.4.0 ...
$ make --version
GNU Make 4.2.1
Built for x86_64-unknown-cygwin ...
$ systeminfo | sed -n 's/^OS\ *//p'
Name:                   Microsoft Windows 7 Enterprise
Version:                6.1.7601 Service Pack 1 Build 7601
Manufacturer:           Microsoft Corporation
Configuration:          Member Workstation
Build Type:             Multiprocessor Free

推荐答案

我的答案

(也请看我在问题下的评论,描述kaldi解决方案.)

注意:解决此问题后出现了另一个问题.请参阅此答案的底部以寻求帮助.

Note: There was another problem which came up after this problem was solved. See the bottom of this answer for help with that.

我一直在努力解决这个问题,结果发现我的答案最终是改变有问题的行(和其他一些行).提醒一下,有问题的行来自文件src/asclite/core/recording.h

I kept working on this, and I found the answer ended up being changing the line in question (and some others) as I will show. As a reminder, the line in question was from the file, src/asclite/core/recording.h

recording.h:122:28: error: template argument 2 is invalid
         map<string, Filter::Filter*> filters;

我将其更改为

map<string, ::Filter*> filters;

我还在src/asclite/core/recording.cpp的第157和164行中进行了相同的更改(从Filter::Filter*更改为::Filter*),结果是:

I also made the same change ( Filter::Filter* to ::Filter* ) in src/asclite/core/recording.cpp, lines 157 and 164, the results being:

157: map<string, ::Filter*>::iterator fi, fe;

164: ::Filter* ptr_elt = fi->second;

在寻找答案和解释时,我还发现了

In looking for the answer and an explanation, I also found another page that has the solution, but no explanation.

下面的解释中有一个让我澄清"的注释,它说明了以下事实:这只是安装的部分解决方案.

There is a "Let me clarify" note in the explanation below that expounds on the fact that this is only a partial solution to the install.

我首先注意到,相关行之前和之后的声明没有名称空间和双冒号,而我们的行则具有Filter::Filter*,如下所示:

I first noticed that the declarations before and after the line in question had no namespace and double colon, whereas our line had Filter::Filter*, as can be seen below:

$ cat src/asclite/core/recording.h |头-n 130 |尾巴-24 地图对齐器;

$ cat src/asclite/core/recording.h | head -n 130 | tail -24 map aligner;

        /**
         * contain all the available Scorer
         */
        map<string, Scorer*> scorer;

        /**
         * contain all the available Segmentors
         */
        map<string, Segmentor*> segmentors;

        /**
                 * contain all the available Filters
         */
        map<string, Filter::Filter*> filters;

                /**
                 * Database for the optimization speaker alignment
                 */
                SpeakerMatch* m_pSpeakerMatch;

                /** the logger */
        static Logger* logger;

我首先尝试同时删除了Filter名称空间和两个冒号(::).我发现了一些网站( 1 2 3 , ...),似乎在头文件中没有名称空间和双冒号的示例.它们仅在实现文件中.我从相关的行和recording.cpp的其他行中删除了Filter::,但这给了我

I first tried removing both the Filter namespace and the two colons (::). I had found a few sites (1, 2, 3, ...), where it seems that there were no examples of namespaces and double colons in header files. They were only in implementation files. I removed Filter:: (from the line in question and from some other lines in recording.cpp), but that gave me

In file included from main.cpp:20:0:
recording.h:122:28: error: template argument 2 is invalid
         map<string, Filter*> filters;
                            ^
recording.h:122:28: error: template argument 4 is invalid

研究了双引号运算符后(例如 ),并在其他解决方案的帮助下,将所有Filter::Filter*更改为::Filter.

After studying the double-quote operator (e.g. here), and with the help of the other solution, I changed all Filter::Filter* to ::Filter.

它编译时带有一些警告,但其余安装过程仍然有效. 让我澄清一下 make configmake all部分有效. make test部分中有错误,在此处另一个问题(待问)中对此进行了详细说明.但是,运行make install会创建我需要的可执行文件.

It compiled with some warnings, but the rest of the installation process worked. Let me clarify The make config and make all parts worked. There were errors in the make test part, detailed in another question here (to be asked). However, running make install creates the executables that I need.

有关前置双冒号的信息,我从另一个SO帖子.构造函数之前的两个冒号卡住了",这使我们知道它在全局范围内,即在recording.h/.cpp之外.这是必需的,因为在recording.h/.cpp中,为创建的Recording对象还有另一个Filter方法. (随着我的写作,事情变得越来越清晰.)

For information about the prepended double-colon, I got some help from another SO post. The two colons "stuck on" before the constructor let us know that it is in the global scope, i.e. outside of the recording.h/.cpp. This is necessary, because in recording.h/.cpp, there is another Filter method for the Recording object created. (Things are becoming clearer as I'm writing.)

$ cat src/asclite/core/recording.cpp | head -n 290 | tail -5
/**
 * Filter the references and hypothesis with the availables filters.
 */
void Recording::Filter(const vector<string> & _filters)
{

$ cat src/asclite/core/recording.h | head -n 75 | tail -4
        /**
         * Filter the references and hypothesis with the availables filters.
         */
        void Filter(const vector<string> & _filters);

我认为我们没有名称空间的原因(即::之前没有Filter)已得到解释在SO 上.在这篇文章中,.cpp(实现)文件中的构造函数代码给出了解释:

I think that the reason we don't have a namespace (i.e. there's no Filter before the ::) is explained here on SO. In this post, code for a constructor in a .cpp (implementation) file is given with an explanation:

Mems::Mems() //you don't actually need to use the class keyword in your .cpp file; 
just the class name, the double colon, and the method name is enough to mark this 
as a class method

据我了解,将Filter::Filter放在Recording对象的代码中将表明Filter::FilterRecording对象的类方法,但这没有任何意义,因为第一个Filter在冒号之前明显地将其标记为Filter对象的类方法.

As I understand it, putting Filter::Filter in the code for a Recording object would suggest that Filter::Filter is a class method for a Recording object, but that doesn't make sense, because the first Filter before the colons obviously marks it as being a class method for a Filter object.

如果此说明有误或不清楚,请立即修复.

此解决方案解决了该问题,但在检查以下内容之前,还有要做的更多.安装成功.

This solution fixed the issue in the question, but there was more to do before the checks for the install succeeded.

这篇关于sclite(SCTK),C ++模板参数Filter :: Filter *无效.西格温的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆