簡體   English   中英

Watson Assistant 提取多個模式實體

[英]Watson Assistant Extract multiple pattern entities

我有一個實體定義為

@code
- @code:type_1 = pattern 'Y(\d{3})'
- @code:type_2 = pattern 'order number(\d{3})'
- @code:type_3 = pattern 'CZ(\d{3})'

我正在嘗試像這樣捕獲以下上下文值

{
  "context": {
    "type_3s": "<? @code.filter(\"c\", \"c['value'] == 'type_3'\").joinToArray('%e.groups[1]%') ?>"
  }
}

所以對於輸入

Please delete codes CZ123, CZ456, and CZ789 ,我的最終上下文如下所示: $type_3s =[123,456,789]

目前收到錯誤

SpEL evaluation error: Expression [ entities['code'].filter("c", "c['value'] == 'type_3'").joinToArray('%e.groups[1]%') ] at position 63: EL1004E: Method call: Method joinToArray(String) cannot be found on ArrayList type

在上面的示例中,code.values 的計算結果為:

@code.values =["type_3", "type_3", "type_3"]

非常感謝您在實現所需上下文方面的任何幫助,非常感謝!

我的建議是查看Watson Assistant 實體語法 .value返回標識的實體type_3 您需要使用.literal來訪問真正輸入的內容。

在有關構建數據庫驅動的 Slackbot的教程中,使用類似的方法來訪問為位置實體輸入的內容。 代碼在 GitHub 上。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM