This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-520
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-520 by this push:
new aa4f1a90 STM additional test.
aa4f1a90 is described below
commit aa4f1a906168ff248e2fd384f7626c7346e2b6a2
Author: Sergey Kamov <[email protected]>
AuthorDate: Sun Jan 22 10:56:40 2023 +0400
STM additional test.
---
.../conversation/NCConversationSpec2.scala | 34 +++++++++++-----------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec2.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec2.scala
index 478b4d75..1dc0c64f 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec2.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec2.scala
@@ -42,32 +42,32 @@ class NCConversationSpec2 extends AnyFunSuite:
val mdl: NCModel =
new NCTestModelAdapter:
override val getPipeline: NCPipeline = mkEnPipeline(
- TE("sale"),
- TE("best", groups = Set("sale", "buy")),
- TE("buy")
+ TE("sell", synonyms = "sales"),
+ TE("best_employee", synonyms = Set("best", "best
employee", "best colleague"), groups = Set("sell", "buy")),
+ TE("buy", synonyms = "purchase")
)
- @NCIntent("intent=salesInfoIntent term~{# == 'sale'}")
- def saleInfo(using ctx: NCContext, im: NCIntentMatch) =
mkResult("sale")
+ @NCIntent("intent=sellIntent term~{# == 'sell'}")
+ def sell(using ctx: NCContext, im: NCIntentMatch) =
mkResult("sell")
- @NCIntent("intent=bestSellerIntent term~{# == 'sale'} term~{#
== 'best'}")
- def bestSeller(using ctx: NCContext, im: NCIntentMatch) =
mkResult("best", "sale")
+ @NCIntent("intent=bestSellerIntent term~{# == 'sell'} term~{#
== 'best_employee'}")
+ def bestSeller(using ctx: NCContext, im: NCIntentMatch) =
mkResult("best_employee", "sell")
- @NCIntent("intent=buysInfoIntent term~{# == 'buy'}")
- def buyInfo(using ctx: NCContext, im: NCIntentMatch) =
mkResult("buy")
+ @NCIntent("intent=buyIntent term~{# == 'buy'}")
+ def buy(using ctx: NCContext, im: NCIntentMatch) =
mkResult("buy")
- @NCIntent("intent=bestBuyerIntent term~{# == 'buy'} term~{# ==
'best'}")
- def bestBuyer(using ctx: NCContext, im: NCIntentMatch) =
mkResult("best", "buy")
+ @NCIntent("intent=bestBuyerIntent term~{# == 'buy'} term~{# ==
'best_employee'}")
+ def bestBuyer(using ctx: NCContext, im: NCIntentMatch) =
mkResult("best_employee", "buy")
Using.resource(new NCModelClient(mdl)) { cli =>
- val dialog = Seq(
- "Give me the sales data" -> Holder("salesInfoIntent", "sale"),
- "Who was the best?" -> Holder("bestSellerIntent", "best",
"sale"),
- "OK, give me the buy report now." ->
Holder("buysInfoIntent","buy"),
- "Who was the best?" -> Holder("bestBuyerIntent", "best", "buy")
+ val questions = Seq(
+ "Give me the sales data" -> Holder("sellIntent", "sell"),
+ "Who was the best?" -> Holder("bestSellerIntent",
"best_employee", "sell"),
+ "OK, give me the purchasing report now." ->
Holder("buyIntent", "buy"),
+ "Who was the best?" -> Holder("bestBuyerIntent",
"best_employee", "buy")
)
- for ((qry, h) <- dialog)
+ for ((qry, h) <- questions)
require(h == cli.ask(qry, "usrId").getBody)
}
}