This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-490
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-490 by this push:
new 893aafe WIP.
893aafe is described below
commit 893aafebfd1eb6e0194bf2228e3b5def2a0e0c3e
Author: Sergey Kamov <[email protected]>
AuthorDate: Wed Mar 30 11:58:36 2022 +0300
WIP.
---
.../internal/intent/matcher/NCIntentSolverManager.scala | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
index 8dbd460..e1431ca 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
@@ -660,10 +660,9 @@ class NCIntentSolverManager(
private var data: Option[IterationResult] = _
def hasNext: Boolean = data == null
- def finish(data: Option[IterationResult] = None): Unit =
- require(data != null)
- Loop.data = data
- def result: Option[IterationResult] =
+ def finish(data: IterationResult): Unit = Loop.data = Option(data)
+ def finish(): Unit = Loop.data = None
+ def result(): Option[IterationResult] =
if data == null then throw new NCRejection("No matching intent
found - all intents were skipped.")
data
@@ -692,7 +691,7 @@ class NCIntentSolverManager(
req.getRequestId,
im.getIntentEntities.asScala.flatMap(_.asScala).toSeq.distinct
)
def finishHistory(): Unit =
-
Loop.finish(Option(IterationResult(Right(CallbackDataImpl(im.getIntentId,
im.getIntentEntities)), im)))
+
Loop.finish(IterationResult(Right(CallbackDataImpl(im.getIntentId,
im.getIntentEntities)), im))
typ match
case REGULAR =>
@@ -704,7 +703,7 @@ class NCIntentSolverManager(
saveHistory(cbRes)
- Loop.finish(Option(IterationResult(Left(cbRes),
im)))
+ Loop.finish(IterationResult(Left(cbRes), im))
case SEARCH =>
saveHistory(new NCResult()) // // Added dummy
result. TODO: is it ok?
finishHistory()
@@ -719,7 +718,7 @@ class NCIntentSolverManager(
case s if s != null => logger.info(s"Selected
intent '${intentRes.intentId}' skipped: $s")
case _ => logger.info(s"Selected intent
'${intentRes.intentId}' skipped.")
- Loop.result
+ Loop.result()
/**
*