4

是否有任何像 Amazon Alexa Custom Skills 一样工作的开源库,您可以在其中为它提供意图模式和要匹配的示例话语,它会提供解析后的标记化响应,其中包含在定义中匹配的实体。

这是一个示例Alexa 自定义技能意图架构

用于训练和指定如何匹配文本和映射到实体的示例话语:

AnswerIntent the answer is {Answer} 
AnswerIntent my answer is {Answer} 
AnswerIntent is it {Answer} 
AnswerIntent {Answer} is my answer AnswerOnlyIntent {Answer}

AMAZON.StartOverIntent start game 
AMAZON.StartOverIntent new game 
AMAZON.StartOverIntent start 
AMAZON.StartOverIntent start new game

另一项服务是https://wit.ai/,它允许您配置表达式和令牌以进行匹配,是否有任何开源库可以提供这种级别的灵活性。

4

4 回答 4

2

Mycroft AI 似乎有一个很好的项目堆栈,提供与 Amazon Alexa Custom Skills 非常相似的功能和程序员界面,您可以自己托管和修改它以获得比 Alexa Voice Service 更大的灵活性(但这也有一点缺点,因为你必须自己缩放它)。

  • https://docs.mycroft.ai/skill.creation

  • https://mycroft.ai/projects/

    • Mycroft Core - 是将自然语言处理、文本到语音、语音到文本和强大的 API 联系在一起的技术,以创造强大的体验,允许用户通过语音控制来操作他们的智能设备和物联网。
    • Open STT - 开源语音到文本模型(似乎他们现在正在为此利用其他 API,例如 Google Speech To Text、Wit.ai 和 IBM Watson)
    • Adapt Intent Parser - 将自然语言转换为机器可读的数据结构
    • 模仿文本到语音- 文本并以高质量的声音大声朗读(目前只是一个提案项目,尚不可用)
于 2016-07-18T16:30:26.973 回答
1

也许,你可以试试 Rasa-nlu。它与 MS Luis 非常相似。您可以将文本解析为结构化数据,例如

{
"entities": [
    {
        "endIndex": null,
        "entity": "hello",
        "score": null,
        "startIndex": null,
        "type": "name"
    }
],
"intents": [
    {
        "intent": "greet",
        "score": 0.640747175086514
    },
    {
        "intent": "goodbye",
        "score": 0.2696910959582717
    },
    {
        "intent": "FindEmployeeLocation",
        "score": 0.05672220244026073
    },
    {
        "intent": "FindEmployee",
        "score": 0.032839526514953594
    }
],
"query": "hello",
"topScoringIntent": {
    "intent": "greet",
    "score": 0.640747175086514
}

您也可以使用 json 或 markdown 格式训练您的语言模型。最重要的是服务是开源的。这意味着您不必为使用它支付额外的费用。您只需设置自己的 nlu 服务器然后使用它。 https://github.com/RasaHQ/rasa_nlu

于 2017-12-20T05:05:47.833 回答
0

如果我说得对,您想提供一个与可能值匹配的模式,并且库必须生成可能的话语列表。如果是这样,除了其他功能之外,还有一个alexa-app项目可以让您执行此操作。它在 MIT 下,因此可以从那里借用所需的代码。例子:

app.intent('sampleIntent',
    {
        "slots":{"NAME":"LITERAL","AGE":"NUMBER"}, 
        "utterances":[ "my {name is|name's} {names|NAME} and {I am|I'm} {1-100|AGE}{ years old|}" ]
    },
    function(request,response) { ... }
);

可能的表达:

my name is John and I am 20 years old
my name's John and I'm 40
my name's Taylor and I'm 55 years old
....
于 2016-07-19T20:58:44.817 回答
-1

OSS解析库很多。大多数实际上比 Alexa 的只是正则表达式的话语模式具有更大的灵活性。

您可以从专门针对 NLP 的库中进行选择,例如 GATE、Stanford Core NLP、OpenNLP 和 NLTK。如果您正在处理大型文档集合,那么 Apache Lucene(或 Solr,如果您愿意的话)是很不错的(尽管 GATE 也支持它们)。

对于更轻的重量,您可以使用通用解析器生成器。有太多无法列出(https://en.wikipedia.org/wiki/Comparison_of_parser_generators),但是像 Antlr 这样的 Packrat 解析器(http://bford.info/packrat/)是高性能且易于使用的。

于 2016-07-17T12:21:51.300 回答