我正在测试NLP工具,现在我遇到了Rasa NLU的问题。
使用API.AI,Wit.ai和LUIS.AI我可以找到我想要的实体,不超过8-10个例子。另一方面,对于Rasa,我已经有18个例子,我找不到实体。即使我的查询恰好与我的一个示例匹配,我仍然有一个空实体数组作为结果。
我正在使用推荐的Docker实例的Rasa,而我当前的管道是["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy", "ner_crf", "ner_synonyms", "intent_classifier_sklearn" and "ner_duckling"]
。
我在查询中指定了我的项目和模型,如下所示:
localhost:5000/parse?q=my_sentence&project=my_project&model=my_model
赞赏任何有用的信息。 谢谢!
{
"text": "How can I make a carrot cake?",
"intent": "AskRecipe",
"entities": [
{
"start": 17,
"end": 27,
"value": "carrot cake",
"entity": "recipe"
}
]
},
{
"text": "What do I need to make a Lemon Pie?",
"intent": "AskRecipe",
"entities": [
{
"start": 25,
"end": 33,
"value": "Lemon Pie",
"entity": "recipe"
}
]
},
{
"text": "What do I need to make brownies?",
"intent": "AskRecipe",
"entities": [
{
"start": 23,
"end": 30,
"value": "brownies",
"entity": "recipe"
}
]
}
然后,当我尝试从“我需要做什么做布朗尼蛋糕?”中提取信息时。 (这也是一个例子)这是结果:
{"entities": [], "intent": {"confidence": 0.8870822891508189, "name": "AskRecipe"}, "text": "What do I need to make brownies?", "intent_ranking": [{"confidence": 0.8870822891508189, "name": "AskRecipe"}, {"confidence": 0.11291771084918109, "name": "greet"}]}
我尝试了很多其他的例子,但没有一个能够奏效。
答案 0 :(得分:2)
我解决了这个问题。
在我的config.json文件中,我将管道值更新为"scapy_sklearn"
而不是["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy", "ner_crf", "ner_synonyms", "intent_classifier_sklearn" and "ner_duckling"]
。
此外,在我训练了一个新模型后,我重新启动了我的docker实例。
我必须说,但是,我成功的docker实例与我发布此问题时所使用的实例并不相同,所以,老实说,我无法100%确定我没有&#39 ; t之前打破任何配置 - 虽然我相信我没有。
我希望这有助于某人:)
答案 1 :(得分:1)
我有同样的问题,Rasa不承认实体。我看到你以不同的方式解决了这个问题,我只想补充一下对我有用的东西因为我发现同样的错误,在发布的例子中 -
结束值必须为import { Injectable, Inject } from '@angular/core';
import { Http, RequestOptionsArgs } from '@angular/http';
import { Logger } from '../../logger';
import { Observable } from 'rxjs/Observable';
import { BaseService } from '../base.service';
import { ServiceConfiguration, UrlConfiguration } from '../service-config.model';
import { Order, CommonResponse } from './Common.model';
import { CommonServiceConstants } from './Common.constants';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
export * from './Common.model';
/**
* The Common Service
* @export
* @class CommonService
* @extends {BaseService}
*/
@Injectable()
export class CommonService extends BaseService {
/**
* Creates an instance of CommonService.
* @param {Http} http
* @memberof CommonService
*/
constructor(private http: Http,
@Inject(CommonServiceConstants.CommonConfigKey) private CommonConfig: ServiceConfiguration,
@Inject(CommonServiceConstants.DefaultHeaders) defaultHeaders: any) {
super(defaultHeaders);
}
/**
* Gets Common
*/
public getCommon(retrievalType: string): Observable<CommonResponse> {
const urlConfig = <UrlConfiguration>this.CommonConfig.urls[CommonServiceConstants.RetrieveCommonName];
const startTime = performance.now();
let retrievalUrl = urlConfig.url + CommonServiceConstants.RetrieveCommonEndpoint;
retrievalUrl = retrievalUrl;
return <Observable<CommonResponse>>this.http.get(retrievalUrl, <RequestOptionsArgs>{
headers: this.getHeaders(urlConfig.headers, retrievalType),
authType: this.CommonConfig.authType,
params: {
'commonRetrievalType': '' + retrievalType
}
})
.map(
(response) => {
Logger.info(CommonService.name, 'Successfully retrieved Common. '
+ ' type: ' + retrievalType, startTime);
return response.json();
}
)
.catch((error: any) => {
Logger.error(CommonService.name, 'Error retrieving Common. '
+ ' type: ' + retrievalType, error);
throw (error);
});
}
}
,因此此处显示的每个“结束”值都应为+1。
我知道这很简单,但它对我有用。