This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch scala
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/scala by this push:
new 80b4979f Scala initial version.
80b4979f is described below
commit 80b4979f9707b934cfb1ac38b0c13e0f428485af
Author: Sergey Kamov <[email protected]>
AuthorDate: Sun Jun 19 12:54:45 2022 +0300
Scala initial version.
---
.../examples/lightswitch/LightSwitchFrModel.scala | 2 +-
.../examples/lightswitch/LightSwitchRuModel.scala | 2 +-
.../examples/lightswitch/LightSwitchScalaModel.scala | 2 +-
.../org/apache/nlpcraft/examples/time/TimeModel.scala | 2 +-
.../main/scala/org/apache/nlpcraft/NCModelConfig.scala | 16 ++++++++--------
.../src/main/scala/org/apache/nlpcraft/NCResult.scala | 6 +++---
.../internal/intent/matcher/NCIntentSolverManager.scala | 6 +++---
.../conversation/NCConversationManagerSpec.scala | 10 +++++++++-
.../internal/conversation/NCConversationSpec.scala | 4 ++--
.../conversation/NCConversationTimeoutSpec.scala | 6 ++----
.../internal/dialogflow/NCDialogFlowManagerSpec.scala | 2 +-
.../nlpcraft/internal/impl/NCModelCallbacksSpec.scala | 10 +++++-----
.../nlpcraft/internal/impl/NCModelClientSpec.scala | 4 ++--
.../nlpcraft/internal/impl/NCModelClientSpec3.scala | 2 +-
.../nlpcraft/internal/impl/NCModelPingPongSpec.scala | 2 +-
.../internal/impl/scan/NCModelIntentsNestedSpec.scala | 16 ++++++++--------
.../nlpcraft/internal/impl/scan/NCTestModelScala.scala | 12 ++++++------
.../org/apache/nlpcraft/nlp/NCEntityEnricherSpec.scala | 2 +-
.../org/apache/nlpcraft/nlp/NCEntityValidatorSpec.scala | 2 +-
.../org/apache/nlpcraft/nlp/NCTokenEnricherSpec.scala | 2 +-
.../org/apache/nlpcraft/nlp/NCTokenValidatorSpec.scala | 2 +-
.../org/apache/nlpcraft/nlp/NCVariantFilterSpec.scala | 2 +-
22 files changed, 60 insertions(+), 54 deletions(-)
diff --git
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchFrModel.scala
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchFrModel.scala
index 4cfeeae9..991f0a1c 100644
---
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchFrModel.scala
+++
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchFrModel.scala
@@ -93,7 +93,7 @@ class LightSwitchFrModel extends NCModelAdapter(
// By default - just return a descriptive action string.
- new NCResult(
+ NCResult(
new Gson().toJson(Map("locations" -> locations, "action" ->
action).asJava),
NCResultType.ASK_RESULT
)
\ No newline at end of file
diff --git
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchRuModel.scala
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchRuModel.scala
index 86abeff1..630fd555 100644
---
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchRuModel.scala
+++
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchRuModel.scala
@@ -75,7 +75,7 @@ class LightSwitchRuModel extends NCModelAdapter(
// Add HomeKit, Arduino or other integration here.
// By default - just return a descriptive action string.
- new NCResult(
+ NCResult(
new Gson().toJson(Map("locations" -> locations, "action" ->
action).asJava),
NCResultType.ASK_RESULT
)
\ No newline at end of file
diff --git
a/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchScalaModel.scala
b/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchScalaModel.scala
index ca62daeb..c4ee5e07 100644
---
a/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchScalaModel.scala
+++
b/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchScalaModel.scala
@@ -85,7 +85,7 @@ class LightSwitchScalaModel extends NCModelAdapter(
// Add HomeKit, Arduino or other integration here.
// By default - just return a descriptive action string.
- new NCResult(
+ NCResult(
s"Lights are [$status] in [${locations.toLowerCase}].",
NCResultType.ASK_RESULT
)
\ No newline at end of file
diff --git
a/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/TimeModel.scala
b/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/TimeModel.scala
index da686af7..75747999 100644
---
a/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/TimeModel.scala
+++
b/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/TimeModel.scala
@@ -66,7 +66,7 @@ class TimeModel extends NCModelAdapter(
)
try
- new NCResult(new ObjectMapper(new
YAMLFactory).writeValueAsString(m), NCResultType.ASK_RESULT)
+ NCResult(new ObjectMapper(new YAMLFactory).writeValueAsString(m),
NCResultType.ASK_RESULT)
catch
case e: JsonProcessingException => throw new
RuntimeException("YAML conversion error.", e)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelConfig.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelConfig.scala
index 28f77d43..e49fe348 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelConfig.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelConfig.scala
@@ -28,12 +28,12 @@ object NCModelConfig:
def apply(id: String, name: String, version: String, description: String,
origin: String) = new NCModelConfig(id, name, version, description, origin)
import org.apache.nlpcraft.NCModelConfig.*
-class NCModelConfig(
- val id: String,
- val name: String,
- val version: String,
- val description: String = null,
- val origin: String = null,
- var conversationTimeout: Long = DFLT_CONV_TIMEOUT,
- var conversationDepth: Int = DFLT_CONV_DEPTH
+case class NCModelConfig(
+ id: String,
+ name: String,
+ version: String,
+ description: String = null,
+ origin: String = null,
+ conversationTimeout: Long = DFLT_CONV_TIMEOUT,
+ conversationDepth: Int = DFLT_CONV_DEPTH
) extends NCPropertyMapAdapter
\ No newline at end of file
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCResult.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCResult.scala
index adde4903..f65048a2 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCResult.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCResult.scala
@@ -20,8 +20,8 @@ package org.apache.nlpcraft
import org.apache.nlpcraft.NCResultType.*
object NCResult:
- def apply(): NCResult = new NCResult()
- def apply(body: Any, resultType: NCResultType): NCResult = new
NCResult(body = body, resultType = resultType)
+ def apply(): NCResult = new NCResult(body = null, resultType = null,
intentId = null)
+ def apply(body: Any, resultType: NCResultType): NCResult = new
NCResult(body = body, resultType = resultType, intentId = null)
def apply(body: Any, resultType: NCResultType, intentId: String): NCResult
= new NCResult(body = body, resultType =resultType, intentId)
-class NCResult(var body: Any = null, var resultType: NCResultType = null, var
intentId: String = null)
+case class NCResult(body: Any, resultType: NCResultType, intentId: String)
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 8355b07b..08688a48 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
@@ -709,9 +709,9 @@ class NCIntentSolverManager(
logger.info(s"Intent '${intentRes.intentId}' for
variant #${intentRes.variantIdx + 1} selected as the <|best match|>")
def executeCallback(im: NCIntentMatch): NCResult =
- val cbRes = intentRes.fn(im)
+ var cbRes = intentRes.fn(im)
// Store winning intent match in the input.
- if cbRes.intentId == null then cbRes.intentId =
intentRes.intentId
+ if cbRes.intentId == null then cbRes =
NCResult(cbRes.body, cbRes.resultType, intentRes.intentId)
cbRes
def finishSearch(): Unit =
@@ -743,7 +743,7 @@ class NCIntentSolverManager(
saveHistory(cbRes, im)
Loop.finish(IterationResult(Left(cbRes), im))
case SEARCH =>
- saveHistory(new NCResult(), im) // Added dummy
result.
+ saveHistory(NCResult(), im) // Added dummy result.
finishSearch()
case SEARCH_NO_HISTORY =>
finishSearch()
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationManagerSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationManagerSpec.scala
index 2d53c49e..7af4559f 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationManagerSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationManagerSpec.scala
@@ -27,7 +27,15 @@ import java.util.function.Predicate
*
*/
class NCConversationManagerSpec:
- case class ModelConfigMock(timeout: Long = Long.MaxValue) extends
NCModelConfig("testId", "test", "1.0", "Test description", "Test origin"):
+ class ModelConfigMock(timeout: Long = Long.MaxValue) extends NCModelConfig(
+ "testId",
+ "test",
+ "1.0",
+ "Test description",
+ "Test origin",
+ NCModelConfig.DFLT_CONV_TIMEOUT,
+ NCModelConfig.DFLT_CONV_DEPTH
+ ):
override val conversationTimeout: Long = timeout
@Test
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec.scala
index 2212e00f..40ab973e 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationSpec.scala
@@ -48,7 +48,7 @@ class NCConversationSpec:
pl
@NCIntent("intent=i1 term(t1)~{# == 'e1'} term(t2)~{# ==
'e2'}?")
- def onMatch(@NCIntentTerm("t1") t1: NCEntity,
@NCIntentTerm("t2") t2: Option[NCEntity]): NCResult = new NCResult()
+ def onMatch(@NCIntentTerm("t1") t1: NCEntity,
@NCIntentTerm("t2") t2: Option[NCEntity]): NCResult = NCResult()
Using.resource(new NCModelClient(mdl)) { cli =>
def execOk(txt: String): Unit = cli.ask(txt, null, usrId)
@@ -92,7 +92,7 @@ class NCConversationSpec:
val conv = im.getContext.getConversation
conv.clearStm(_ => true)
conv.clearDialog(_ => true)
- new NCResult()
+ NCResult()
Using.resource(new NCModelClient(mdl)) { client =>
client.ask("e1", null, "userId")
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationTimeoutSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationTimeoutSpec.scala
index 0bca45d4..d9ecd85e 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationTimeoutSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationTimeoutSpec.scala
@@ -45,9 +45,7 @@ class NCConversationTimeoutSpec:
val mdl: NCModel =
new NCTestModelAdapter:
override val getConfig: NCModelConfig =
- val cfg = CFG
- cfg.conversationTimeout = TIMEOUT
- cfg
+ new NCModelConfig(CFG.id, CFG.name, CFG.version,
CFG.description, CFG.origin, TIMEOUT, CFG.conversationDepth)
override val getPipeline: NCPipeline =
val pl = mkEnPipeline
@@ -57,7 +55,7 @@ class NCConversationTimeoutSpec:
@NCIntent("intent=i term(e)~{# == 'test'}")
def onMatch(im: NCIntentMatch, @NCIntentTerm("e") e:
NCEntity): NCResult =
val conv = im.getContext.getConversation
- val res = new
NCResult(conv.getData.getOpt("key").getOrElse(EMPTY), NCResultType.ASK_RESULT)
+ val res =
NCResult(conv.getData.getOpt("key").getOrElse(EMPTY), NCResultType.ASK_RESULT)
// For next calls.
conv.getData.put("key", VALUE)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/dialogflow/NCDialogFlowManagerSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/dialogflow/NCDialogFlowManagerSpec.scala
index 2d560b7a..c305c545 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/dialogflow/NCDialogFlowManagerSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/dialogflow/NCDialogFlowManagerSpec.scala
@@ -45,7 +45,7 @@ class NCDialogFlowManagerSpec:
override def getVariants: List[NCVariant] = null
override def getTokens: List[NCToken] = null
- case class ModelConfigMock(timeout: Long = Long.MaxValue) extends
NCModelConfig("testId", "test", "1.0", "Test description", "Test origin"):
+ class ModelConfigMock(timeout: Long = Long.MaxValue) extends
NCModelConfig("testId", "test", "1.0", "Test description", "Test origin",
NCModelConfig.DFLT_CONV_TIMEOUT, NCModelConfig.DFLT_CONV_DEPTH):
override val conversationTimeout: Long = timeout
private var mgr: NCDialogFlowManager = _
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelCallbacksSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelCallbacksSpec.scala
index d9b77d7c..0e475e02 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelCallbacksSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelCallbacksSpec.scala
@@ -42,11 +42,11 @@ class NCModelCallbacksSpec:
private val states = collection.mutable.HashSet.empty[State]
- private val RESULT_INTENT = new NCResult("result-intent",
NCResultType.ASK_RESULT)
- private val RESULT_CONTEXT = new NCResult("result-context",
NCResultType.ASK_RESULT)
- private val RESULT_RESULT = new NCResult("result-result",
NCResultType.ASK_RESULT)
- private val RESULT_REJECTION = new NCResult("result-rejection",
NCResultType.ASK_RESULT)
- private val RESULT_ERROR = new NCResult("result-error",
NCResultType.ASK_RESULT)
+ private val RESULT_INTENT = NCResult("result-intent",
NCResultType.ASK_RESULT)
+ private val RESULT_CONTEXT = NCResult("result-context",
NCResultType.ASK_RESULT)
+ private val RESULT_RESULT = NCResult("result-result",
NCResultType.ASK_RESULT)
+ private val RESULT_REJECTION = NCResult("result-rejection",
NCResultType.ASK_RESULT)
+ private val RESULT_ERROR = NCResult("result-error",
NCResultType.ASK_RESULT)
private val MDL: NCTestModelAdapter =
new NCTestModelAdapter():
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientSpec.scala
index 0fa0d1f2..0cdaa76a 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientSpec.scala
@@ -68,7 +68,7 @@ class NCModelClientSpec:
new NCTestModelAdapter():
@NCIntentSample(Array("Lights on at second floor kitchen"))
@NCIntent("intent=ls term(act)={# == 'ls:on'} term(loc)={# ==
'ls:loc'}*")
- def onMatch(@NCIntentTerm("act") act: NCEntity,
@NCIntentTerm("loc") locs: List[NCEntity]): NCResult = new NCResult()
+ def onMatch(@NCIntentTerm("act") act: NCEntity,
@NCIntentTerm("loc") locs: List[NCEntity]): NCResult = NCResult()
)
/**
@@ -80,6 +80,6 @@ class NCModelClientSpec:
new NCTestModelAdapter():
@NCIntent("intent=ls term(act)={has(ent_groups, 'act')}
term(loc)={# == 'ls:loc'}*")
@NCIntentSample(Array("Lights on at second floor kitchen"))
- def onMatch(@NCIntentTerm("act") act: NCEntity,
@NCIntentTerm("loc") locs: List[NCEntity]): NCResult = new NCResult()
+ def onMatch(@NCIntentTerm("act") act: NCEntity,
@NCIntentTerm("loc") locs: List[NCEntity]): NCResult = NCResult()
)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientSpec3.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientSpec3.scala
index 591d7263..feececf3 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientSpec3.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientSpec3.scala
@@ -44,7 +44,7 @@ class NCModelClientSpec3:
pl
@NCIntent("intent=i1 term(t1)={# == 'e1'}")
- def onMatch(@NCIntentTerm("t1") t1: NCEntity): NCResult = new
NCResult("Data", NCResultType.ASK_RESULT)
+ def onMatch(@NCIntentTerm("t1") t1: NCEntity): NCResult =
NCResult("Data", NCResultType.ASK_RESULT)
Using.resource(new NCModelClient(mdl)) { client =>
def ask(): NCCallbackData = client.debugAsk("e1", null, "userId",
true)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelPingPongSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelPingPongSpec.scala
index a004b0a1..f33150f8 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelPingPongSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelPingPongSpec.scala
@@ -34,7 +34,7 @@ import scala.util.Using
class NCModelPingPongSpec:
private var client: NCModelClient = _
- private case class R(resType: NCResultType, txt: String) extends
NCResult(txt, resType):
+ private class R(resType: NCResultType, txt: String) extends NCResult(txt,
resType, null):
override def toString: String = s"$resType ($txt)"
private val MDL: NCTestModelAdapter =
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsNestedSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsNestedSpec.scala
index fc2e288c..3fe98a5e 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsNestedSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsNestedSpec.scala
@@ -32,20 +32,20 @@ class NCModelIntentsNestedSpec:
@NCIntentObject
val nested2: Object = new Object():
@NCIntent("intent=intent3 term(x)~{true}")
- def intent1(@NCIntentTerm("x") x: NCEntity) = new NCResult()
+ def intent1(@NCIntentTerm("x") x: NCEntity) = NCResult()
@NCIntent("intent=intent2 term(x)~{true}")
- def intent1(@NCIntentTerm("x") x: NCEntity) = new NCResult()
+ def intent1(@NCIntentTerm("x") x: NCEntity) = NCResult()
@NCIntent("intent=intent1 term(x)~{true}")
- def intent1(@NCIntentTerm("x") x: NCEntity) = new NCResult()
+ def intent1(@NCIntentTerm("x") x: NCEntity) = NCResult()
@NCIntent("import('scan/idl.idl')")
def intent4(
@NCIntentTerm("single") single: NCEntity,
@NCIntentTerm("list") list: List[NCEntity],
@NCIntentTerm("opt") opt: Option[NCEntity]
- ): NCResult = new NCResult()
+ ): NCResult = NCResult()
private val MDL_VALID2: NCModel = new NCTestModelAdapter:
@NCIntent("import('scan/idl.idl')")
@@ -56,20 +56,20 @@ class NCModelIntentsNestedSpec:
@NCIntentObject
val nested2 = new RefClass():
@NCIntent("intent=intent3 term(x)~{true}")
- def intent1(@NCIntentTerm("x") x: NCEntity) = new NCResult()
+ def intent1(@NCIntentTerm("x") x: NCEntity) = NCResult()
@NCIntent("intent=intent2 term(x)~{true}")
- def intent1(@NCIntentTerm("x") x: NCEntity) = new NCResult()
+ def intent1(@NCIntentTerm("x") x: NCEntity) = NCResult()
@NCIntent("intent=intent1 term(x)~{true}")
- def intent1(@NCIntentTerm("x") x: NCEntity) = new NCResult()
+ def intent1(@NCIntentTerm("x") x: NCEntity) = NCResult()
@NCIntentRef("impIntId") // Reference via nested2 (RefClass)
def intent4(
@NCIntentTerm("single") single: NCEntity,
@NCIntentTerm("list") list: List[NCEntity],
@NCIntentTerm("opt") opt: Option[NCEntity]
- ): NCResult = new NCResult()
+ ): NCResult = NCResult()
private val MDL_INVALID: NCModel = new NCTestModelAdapter :
@NCIntentObject
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCTestModelScala.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCTestModelScala.scala
index 9c6ea2ca..485b8942 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCTestModelScala.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCTestModelScala.scala
@@ -31,7 +31,7 @@ object NCTestModelScala:
@NCIntentTerm("single") single: NCEntity,
@NCIntentTerm("list") list: Seq[NCEntity],
@NCIntentTerm("opt") opt: Option[NCEntity]
- ): NCResult = new NCResult()
+ ): NCResult = NCResult()
@NCIntent("import('scan/idl.idl')")
@NCIntentSampleRef("scan/samples.txt")
@@ -39,7 +39,7 @@ object NCTestModelScala:
@NCIntentTerm("single") single: NCEntity,
@NCIntentTerm("list") list: List[NCEntity],
@NCIntentTerm("opt") opt: Option[NCEntity]
- ): NCResult = new NCResult()
+ ): NCResult = NCResult()
@NCIntent("import('scan/idl.idl')")
class NCTestModelScalaClass extends NCTestModelAdapter :
@@ -49,7 +49,7 @@ object NCTestModelScala:
@NCIntentTerm("single") single: NCEntity,
@NCIntentTerm("list") list: Seq[NCEntity],
@NCIntentTerm("opt") opt: Option[NCEntity]
- ) = new NCResult()
+ ) = NCResult()
@NCIntentRef("impIntId")
@NCIntentSampleRef("scan/samples.txt")
@@ -57,7 +57,7 @@ object NCTestModelScala:
@NCIntentTerm("single") single: NCEntity,
@NCIntentTerm("list") list: List[NCEntity],
@NCIntentTerm("opt") opt: Option[NCEntity]
- ) = new NCResult()
+ ) = NCResult()
/**
*
@@ -70,7 +70,7 @@ object NCTestModelScala:
@NCIntentTerm("single") single: NCEntity,
@NCIntentTerm("list") list: Seq[NCEntity],
@NCIntentTerm("opt") opt: Option[NCEntity]
- ): NCResult = new NCResult()
+ ): NCResult = NCResult()
@NCIntent("import('scan/idl.idl')")
@NCIntentSampleRef("scan/samples.txt")
@@ -78,4 +78,4 @@ object NCTestModelScala:
@NCIntentTerm("single") single: NCEntity,
@NCIntentTerm("list") list: List[NCEntity],
@NCIntentTerm("opt") opt: Option[NCEntity]
- ): NCResult = new NCResult()
+ ): NCResult = NCResult()
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityEnricherSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityEnricherSpec.scala
index 6d967f8c..ed26c3e7 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityEnricherSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityEnricherSpec.scala
@@ -34,7 +34,7 @@ class NCEntityEnricherSpec:
private def test0(pipeline: NCPipeline, ok: Boolean): Unit =
val mdl: NCModel = new NCModelAdapter(new NCModelConfig("test.id",
"Test model", "1.0"), pipeline):
@NCIntent("intent=i term(any)={meta_ent('k1') == 'v1'}")
- def onMatch(): NCResult = new NCResult("OK",
NCResultType.ASK_RESULT)
+ def onMatch(): NCResult = NCResult("OK", NCResultType.ASK_RESULT)
NCTestUtils.askSomething(mdl, ok)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityValidatorSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityValidatorSpec.scala
index a6c23156..376b09fa 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityValidatorSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityValidatorSpec.scala
@@ -32,7 +32,7 @@ import scala.util.Using
class NCEntityValidatorSpec:
private def test0(pipeline: NCPipeline, ok: Boolean): Unit =
val mdl: NCModel = new NCModelAdapter(new NCModelConfig("test.id",
"Test model", "1.0"), pipeline):
- override def onContext(ctx: NCContext): NCResult = new
NCResult("OK", NCResultType.ASK_RESULT)
+ override def onContext(ctx: NCContext): NCResult = NCResult("OK",
NCResultType.ASK_RESULT)
NCTestUtils.askSomething(mdl, ok)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCTokenEnricherSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCTokenEnricherSpec.scala
index a63fb485..04f652a6 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCTokenEnricherSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCTokenEnricherSpec.scala
@@ -34,7 +34,7 @@ class NCTokenEnricherSpec:
private def test0(pipeline: NCPipeline, ok: Boolean): Unit =
val mdl: NCModel = new NCModelAdapter(new NCModelConfig("test.id",
"Test model", "1.0"), pipeline):
@NCIntent("intent=i term(any)={meta_ent('nlp:token:k1') == 'v1'}")
- def onMatch(): NCResult = new NCResult("OK",
NCResultType.ASK_RESULT)
+ def onMatch(): NCResult = NCResult("OK", NCResultType.ASK_RESULT)
NCTestUtils.askSomething(mdl, ok)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCTokenValidatorSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCTokenValidatorSpec.scala
index b9a6bf79..3817f6fb 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCTokenValidatorSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCTokenValidatorSpec.scala
@@ -32,7 +32,7 @@ import scala.util.Using
class NCTokenValidatorSpec:
private def test0(pipeline: NCPipeline, ok: Boolean): Unit =
val mdl: NCModel = new NCModelAdapter(new NCModelConfig("test.id",
"Test model", "1.0"), pipeline):
- override def onContext(ctx: NCContext): NCResult = new
NCResult("OK", NCResultType.ASK_RESULT)
+ override def onContext(ctx: NCContext): NCResult = NCResult("OK",
NCResultType.ASK_RESULT)
NCTestUtils.askSomething(mdl, ok)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCVariantFilterSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCVariantFilterSpec.scala
index 71a5040d..586cb09b 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCVariantFilterSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCVariantFilterSpec.scala
@@ -35,7 +35,7 @@ class NCVariantFilterSpec:
private def test0(pipeline: NCPipeline, ok: Boolean): Unit =
val mdl: NCModel = new NCModelAdapter(new NCModelConfig("test.id",
"Test model", "1.0"), pipeline):
@NCIntent("intent=i term(any)={true}")
- def onMatch(): NCResult = new NCResult("OK",
NCResultType.ASK_RESULT)
+ def onMatch(): NCResult = NCResult("OK", NCResultType.ASK_RESULT)
NCTestUtils.askSomething(mdl, ok)