简体   繁体   English

在bluemix上创建NLC分类器

[英]creating NLC classifier on bluemix

when i try to create a new classifier of NLC, based on this documentation: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/natural-language-classifier/api/v1/?node#create_classifier 当我尝试根据此文档创建NLC的新分类器时: http : //www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/natural-language-classifier/api/v1/? node#create_classifier

I can't create a new classifier. 我无法创建新的分类器。 This is the error: 这是错误:

{ code: 400, error: undefined }

I shouldn't receive that kind of error. 我不应该收到这种错误。

The CSV file is very small, just for test. CSV文件非常小,仅供测试。

Maybe i am doing something wrong. 也许我做错了。 But that error: "undefined" doesn't say nothing... 但是那个错误:“未定义”什么也没说...


This is the code (The same as the documentation) 这是代码(与文档相同)

var params = {
            language: 'es',
            name: "Train_NODE",
            training_data: fs.createReadStream('./public/uploads/'+req.files.file.name)
        };
        natural_language_classifier.create(params, function(err, response) {
            if (err){
                console.log(err);
                res.status(500).render('./APIs/NLC/', {
                    title: err.description
                });
            }else{
                console.log(JSON.stringify(response, null, 2));
                res.status(200).render('./APIs/NLC/', {
                    title: 'Natural Language Classifer'
                });
            }
        });

Somebody knows what to do? 有人知道该怎么办吗?

Issue here was with the file path being used. 这里的问题是正在使用的文件路径。 It returned a file that did not exist. 它返回了不存在的文件。 Once the file path to the training.csv was hardcoded in, everything worked fine. 硬编码training.csv的文件路径后,一切工作正常。

So we got the 400 error when we used './public/uploads/'+req.files.file.name, but it worked when we used './public/uploads/MyTrainingFile.csv'. 因此,当我们使用'./public/uploads/'+req.files.file.name时,出现了400错误,但是当我们使用'./public/uploads/MyTrainingFile.csv'时,它可以工作。

We would anticipate some more descriptive error message though. 我们将期待一些更具描述性的错误消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM